/** * Creates and returns a {@link org.jboss.marshalling.Marshaller} which is ready to be used for marshalling. The * {@link org.jboss.marshalling.Marshaller#start(org.jboss.marshalling.ByteOutput)} will be invoked by this method, to use * the passed {@link java.io.DataOutput dataOutput}, before returning the marshaller. * * @param dataOutput The {@link java.io.DataOutput} to which the data will be marshalled * @return * @throws IOException */ protected org.jboss.marshalling.Marshaller prepareForMarshalling(final DataOutput dataOutput) throws IOException { final org.jboss.marshalling.Marshaller marshaller = this.getMarshaller(marshallerFactory); final OutputStream outputStream = new OutputStream() { @Override public void write(int b) throws IOException { final int byteToWrite = b & 0xff; dataOutput.write(byteToWrite); } }; final ByteOutput byteOutput = Marshalling.createByteOutput(outputStream); // start the marshaller marshaller.start(byteOutput); return marshaller; }
/** * Creates and returns a {@link org.jboss.marshalling.Unmarshaller} which is ready to be used for unmarshalling. The * {@link org.jboss.marshalling.Unmarshaller#start(org.jboss.marshalling.ByteInput)} will be invoked by this method, to use * the passed {@link java.io.DataInput dataInput}, before returning the unmarshaller. * * @param dataInput The data input from which to unmarshall * @param classResolver The class resolver to use for unmarshalling * @return * @throws IOException */ protected Unmarshaller prepareForUnMarshalling(final DataInput dataInput, final ClassResolver classResolver) throws IOException { final Unmarshaller unmarshaller = this.getUnMarshaller(marshallerFactory, classResolver); final InputStream is = new InputStream() { @Override public int read() throws IOException { try { final int b = dataInput.readByte(); return b & 0xff; } catch (EOFException eof) { return -1; } } }; final ByteInput byteInput = Marshalling.createByteInput(is); // start the unmarshaller unmarshaller.start(byteInput); return unmarshaller; }
/** * Creates and returns a {@link org.jboss.marshalling.Unmarshaller} which is ready to be used for unmarshalling. The * {@link org.jboss.marshalling.Unmarshaller#start(org.jboss.marshalling.ByteInput)} will be invoked by this method, to use * the passed {@link java.io.DataInput dataInput}, before returning the unmarshaller. * * This unmarshaller will use the context class loader to resolve any classes. * * @param dataInput The data input from which to unmarshall * @return * @throws IOException */ protected Unmarshaller prepareForUnMarshalling(final DataInput dataInput) throws IOException { return prepareForUnMarshalling(dataInput, DefaultClassResolver.INSTANCE); }
/** * Creates and returns a {@link org.jboss.marshalling.Unmarshaller} which is ready to be used for unmarshalling. The * {@link org.jboss.marshalling.Unmarshaller#start(org.jboss.marshalling.ByteInput)} will be invoked by this method, to use * the passed {@link java.io.DataInput dataInput}, before returning the unmarshaller. * * This unmarshaller will use the context class loader to resolve any classes. * * @param dataInput The data input from which to unmarshall * @return * @throws IOException */ protected Unmarshaller prepareForUnMarshalling(final DataInput dataInput) throws IOException { return prepareForUnMarshalling(dataInput, DefaultClassResolver.INSTANCE); }
/** * Creates and returns a {@link org.jboss.marshalling.Marshaller} which is ready to be used for marshalling. The * {@link org.jboss.marshalling.Marshaller#start(org.jboss.marshalling.ByteOutput)} will be invoked by this method, to use * the passed {@link java.io.DataOutput dataOutput}, before returning the marshaller. * * @param dataOutput The {@link java.io.DataOutput} to which the data will be marshalled * @return * @throws IOException */ protected org.jboss.marshalling.Marshaller prepareForMarshalling(final DataOutput dataOutput) throws IOException { final org.jboss.marshalling.Marshaller marshaller = this.getMarshaller(marshallerFactory); final OutputStream outputStream = new OutputStream() { @Override public void write(int b) throws IOException { final int byteToWrite = b & 0xff; dataOutput.write(byteToWrite); } }; final ByteOutput byteOutput = Marshalling.createByteOutput(outputStream); // start the marshaller marshaller.start(byteOutput); return marshaller; }
/** * Creates and returns a {@link org.jboss.marshalling.Unmarshaller} which is ready to be used for unmarshalling. The * {@link org.jboss.marshalling.Unmarshaller#start(org.jboss.marshalling.ByteInput)} will be invoked by this method, to use * the passed {@link java.io.DataInput dataInput}, before returning the unmarshaller. * * @param dataInput The data input from which to unmarshall * @param classResolver The class resolver to use for unmarshalling * @return * @throws IOException */ protected Unmarshaller prepareForUnMarshalling(final DataInput dataInput, final ClassResolver classResolver) throws IOException { final Unmarshaller unmarshaller = this.getUnMarshaller(marshallerFactory, classResolver); final InputStream is = new InputStream() { @Override public int read() throws IOException { try { final int b = dataInput.readByte(); return b & 0xff; } catch (EOFException eof) { return -1; } } }; final ByteInput byteInput = Marshalling.createByteInput(is); // start the unmarshaller unmarshaller.start(byteInput); return unmarshaller; }
/** * Creates and returns a {@link org.jboss.marshalling.Unmarshaller} which is ready to be used for unmarshalling. The * {@link org.jboss.marshalling.Unmarshaller#start(org.jboss.marshalling.ByteInput)} will be invoked by this method, to use * the passed {@link java.io.DataInput dataInput}, before returning the unmarshaller. * * This unmarshaller will use the context class loader to resolve any classes. * * @param dataInput The data input from which to unmarshall * @return * @throws IOException */ protected Unmarshaller prepareForUnMarshalling(final DataInput dataInput) throws IOException { return prepareForUnMarshalling(dataInput, DefaultClassResolver.INSTANCE); }
/** * Creates and returns a {@link org.jboss.marshalling.Marshaller} which is ready to be used for marshalling. The * {@link org.jboss.marshalling.Marshaller#start(org.jboss.marshalling.ByteOutput)} will be invoked by this method, to use * the passed {@link java.io.DataOutput dataOutput}, before returning the marshaller. * * @param dataOutput The {@link java.io.DataOutput} to which the data will be marshalled * @return * @throws IOException */ protected org.jboss.marshalling.Marshaller prepareForMarshalling(final DataOutput dataOutput) throws IOException { final org.jboss.marshalling.Marshaller marshaller = this.getMarshaller(marshallerFactory); final OutputStream outputStream = new OutputStream() { @Override public void write(int b) throws IOException { final int byteToWrite = b & 0xff; dataOutput.write(byteToWrite); } }; final ByteOutput byteOutput = Marshalling.createByteOutput(outputStream); // start the marshaller marshaller.start(byteOutput); return marshaller; }
/** * Creates and returns a {@link org.jboss.marshalling.Unmarshaller} which is ready to be used for unmarshalling. The * {@link org.jboss.marshalling.Unmarshaller#start(org.jboss.marshalling.ByteInput)} will be invoked by this method, to use * the passed {@link java.io.DataInput dataInput}, before returning the unmarshaller. * * @param dataInput The data input from which to unmarshall * @param classResolver The class resolver to use for unmarshalling * @return * @throws IOException */ protected Unmarshaller prepareForUnMarshalling(final DataInput dataInput, final ClassResolver classResolver) throws IOException { final Unmarshaller unmarshaller = this.getUnMarshaller(marshallerFactory, classResolver); final InputStream is = new InputStream() { @Override public int read() throws IOException { try { final int b = dataInput.readByte(); return b & 0xff; } catch (EOFException eof) { return -1; } } }; final ByteInput byteInput = Marshalling.createByteInput(is); // start the unmarshaller unmarshaller.start(byteInput); return unmarshaller; }