@Override public Marshaller getMarshaller(ChannelHandlerContext ctx) throws Exception { return factory.createMarshaller(config); }
@Override public Unmarshaller getUnmarshaller(ChannelHandlerContext ctx) throws Exception { return factory.createUnmarshaller(config); }
public void writeObject(final Marshaller marshaller, final Object obj) throws IOException { marshaller.writeByte(idx); objectTable.getObjectWriter(obj).writeObject(marshaller, obj); } }));
public static Unmarshaller createUnmarshaller(MessageInputStream is, MarshallingConfiguration configuration) throws IOException { final Unmarshaller unmarshaller = riverMarshallerFactory.createUnmarshaller(configuration); unmarshaller.start(Marshalling.createByteInput(is)); return unmarshaller; }
public static Marshaller createMarshaller(MessageOutputStream os, MarshallingConfiguration configuration) throws IOException { final Marshaller marshaller = riverMarshallerFactory.createMarshaller(configuration); marshaller.start(new OutputStreamByteOutput(os) { @Override public void flush() throws IOException { //ignore flushes, all they do is wreck performance as you get a double flush when closing the marshaller //which results in two network packets being sent } }); return marshaller; }
RemoteServerTransport(final Channel channel, final int version, final MessageTracker messageTracker, final Context localContext) { this.channel = channel; this.version = version; this.messageTracker = messageTracker; this.localContext = localContext; this.configuration = new MarshallingConfiguration(); configuration.setVersion(version == 2 ? 4 : 2); configuration.setClassResolver(new ContextClassResolver()); }
StepObjectOutput(final Queue<Step> steps) throws IOException { super(SerializingCloner.this.bufferSize); this.steps = steps; super.start(Marshalling.createByteOutput(byteArrayOutputStream)); }
public void writeClass(final Marshaller marshaller, final Class<?> clazz) throws IOException { marshaller.writeByte(idx); classTable.getClassWriter(clazz).writeClass(marshaller, clazz); } }));
/** {@inheritDoc} */ public Writer getObjectWriter(final Object obj) throws IOException { for (Pair<ObjectTable, Writer> entry : writers) { final ObjectTable table = entry.getA(); final Writer writer = entry.getB(); if (table.getObjectWriter(obj) != null) { return writer; } } return null; }
@Override public int read(byte[] array, int offset, int length) throws IOException { int readable = readable(length); if (readable > 0) { int i = input.read(array, offset, readable); read += i; return i; } else { throw EXCEPTION; } }
@Override public long skip(long bytes) throws IOException { int readable = readable((int) bytes); if (readable > 0) { long i = input.skip(readable); read += i; return i; } else { throw EXCEPTION; } }
@Override public int available() throws IOException { return readable(input.available()); }
/** * Add information about a field which was being marshalled. * * @param t the throwable to update * @param fieldName the field name being (un-)marshalled */ public static void addFieldInformation(Throwable t, String fieldName) { final TraceInformation ti = getOrAddTraceInformation(t); final Info oldInfo = ti.info; ti.info = new FieldInfo(oldInfo, fieldName); }
/** {@inheritDoc} */ public void finish() throws IOException { try { super.finish(); } finally { clearClassCache(); } }
@Override public Unmarshaller getUnmarshaller(ChannelHandlerContext ctx) throws Exception { return factory.createUnmarshaller(config); }
@Override public Marshaller getMarshaller(ChannelHandlerContext ctx) throws Exception { return factory.createMarshaller(config); }
@Override public int read() throws IOException { int readable = readable(1); if (readable > 0) { int b = input.read(); read++; return b; } else { throw EXCEPTION; } }
@Override public Unmarshaller getUnmarshaller(ChannelHandlerContext ctx) throws Exception { Unmarshaller unmarshaller = unmarshallers.get(); if (unmarshaller == null) { unmarshaller = factory.createUnmarshaller(config); unmarshallers.set(unmarshaller); } return unmarshaller; }
@Override public Marshaller getMarshaller(ChannelHandlerContext ctx) throws Exception { Marshaller marshaller = marshallers.get(); if (marshaller == null) { marshaller = factory.createMarshaller(config); marshallers.set(marshaller); } return marshaller; } }