HeaderChunk { public void writeHeader(OutputStream outputStream) throws IOException { outputStream.write(header); } HeaderChunk(); void writeHeader(OutputStream outputStream); void setFlags(int flags); void setPacketSize(int packetSize); @Override String toString(); static final int FLAG_ZLIB; static final int FLAG_RENCODE; static final int FLAG_CIPHER; static final int FLAG_YAML; static final int FLAG_LZ4; static final int FLAG_LZO; static final int FLAGS_NOHEADER; }
@Test public void testWriteHeader() throws IOException { headerChunk.setFlags(FLAGS); headerChunk.setCompressionLevel(COMPRESSION_LVL); headerChunk.setPacketIndex(PACKET_INDEX); headerChunk.setPacketSize(3); ByteArrayOutputStream out = new ByteArrayOutputStream(); headerChunk.writeHeader(out); assertArrayEquals(HEADER, out.toByteArray()); }