Esempio n. 1
0
 private void readFromBuffer(ByteBuffer buf) throws IOException {
   this.buf = buf;
   buf.order(ByteOrder.LITTLE_ENDIAN);
   header = new Header();
   header.read(buf);
   fixupHeader();
 }
Esempio n. 2
0
 private byte[] read(byte[] data, int pos) throws IOException {
   ByteArrayOutputStream out = new ByteArrayOutputStream();
   ByteArrayInputStream bis = new ByteArrayInputStream(data);
   Header header = new Header();
   header.read(data, pos);
   bis.skip(pos + header.getSize());
   InflaterInputStream inflater = new InflaterInputStream(bis);
   byte[] chunk = new byte[4096];
   int count;
   while ((count = inflater.read(chunk)) >= 0) {
     out.write(chunk, 0, count);
   }
   inflater.close();
   return out.toByteArray();
 }