* @param dataInput The data input from which to unmarshall
* @return
* @throws IOException
*/
protected Unmarshaller prepareForUnMarshalling(final MarshallerFactory marshallerFactory, final ClassResolver classResolver, final DataInputStream dataInput) 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;
}
}
@Override
public int read(final byte[] b, final int off, final int len) throws IOException {
return dataInput.read(b, off, len);
}
@Override
public int read(final byte[] b) throws IOException {
return dataInput.read(b);
}
};
final ByteInput byteInput = Marshalling.createByteInput(is);
// start the unmarshaller
unmarshaller.start(byteInput);
return unmarshaller;
}