byte[] header = new byte[4]; byte[] data; int readSize;  in.read(header); headerTag = new String(header); chunkSize = (int)readLongReverse(in); if(chunkSize > 0) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); data = new byte[chunkSize]; readSize = in.read(data, 0, chunkSize); if(readSize!=chunkSize) throw new IOException("Incomplete read!"); baos.write(data); bais = new ByteArrayInputStream(baos.toByteArray()); }
byte[] header = new byte[4]; byte[] data; int readSize;  in.read(header); headerTag = new String(header); chunkSize = (int)Util.readLongReverse(in); if(chunkSize > 0) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); data = new byte[chunkSize]; readSize = in.read(data, 0, chunkSize); if(readSize!=chunkSize) throw new IOException("Incomplete read!"); baos.write(data); bais = new ByteArrayInputStream(baos.toByteArray()); }
    public Chunk(InputStream in) throws IOException {	byte[] header = new byte[4];	byte[] data;	int readSize;	        in.read(header);	headerTag = new String(header);	chunkSize = (int)readLongReverse(in);	if(chunkSize > 0) {		ByteArrayOutputStream baos = new ByteArrayOutputStream();		data = new byte[chunkSize];		readSize = in.read(data, 0, chunkSize);		if(readSize!=chunkSize)			throw new IOException("Incomplete read!");		baos.write(data);		bais = new ByteArrayInputStream(baos.toByteArray());	}    }