int documentLength = ByteBuffer.wrap(buf).order(ByteOrder.LITTLE_ENDIAN).getInt();
InputStream in = new BoundedInputStream(_rawInputStream, documentLength - buf.length);
//buffer if the raw input stream is not already buffered
if (!(_rawInputStream instanceof BufferedInputStream)) {
in = new StaticBufferedInputStream(in);
}
_counter = new CountingInputStream(in);
_in = new LittleEndianInputStream(_counter);
} else {
//read document header (skip size, we're not interested)