PcapGlobalHeader { public static PcapGlobalHeader createDefaultHeader() { return createDefaultHeader(Protocol.ETHERNET_II); } PcapGlobalHeader(final ByteOrder byteOrder, final byte[] body);  PcapGlobalHeader(final ByteOrder byteOrder, final byte[] body, final boolean nsTimestamps); static PcapGlobalHeader createDefaultHeader(); static PcapGlobalHeader createDefaultHeader(Protocol protocol); ByteOrder getByteOrder(); boolean timestampsInNs(); int getMajorVersion(); int getMinorVersion(); int getTimeAccuracy(); long getTimeZoneCorrection(); long getSnapLength(); int getDataLinkType(); static final int getUnsignedShort(final int offset, final byte[] buffer, final ByteOrder byteOrder); static final long getUnsignedInt(final int offset, final byte[] buffer, final ByteOrder byteOrder); static final int getInt(final int offset, final byte[] buffer, final ByteOrder byteOrder); static final PcapGlobalHeader parse(final Buffer in); void write(final OutputStream out); @Override String toString(); static long unsignedInt(final byte a, final byte b, final byte c, final byte d); static final int SIZE; static final byte[] MAGIC_BIG_ENDIAN; static final byte[] MAGIC_LITTLE_ENDIAN; static final byte[] MAGIC_NGPCAP; static final byte[] MAGIC_NSEC; static final byte[] MAGIC_NSEC_SWAPPED; static final byte[] MAGIC_MODIFIED; static final byte[] MAGIC_MODIFIED_SWAPPED; }
@Test public void testCreateDefaultHeader() { final PcapGlobalHeader header = PcapGlobalHeader.createDefaultHeader(); assertThat(header.getMajorVersion(), is(2)); assertThat(header.getMinorVersion(), is(4)); assertThat(header.getSnapLength(), is(65535L)); assertThat(header.getTimeAccuracy(), is(0)); assertThat(header.getTimeZoneCorrection(), is(0L)); assertThat(header.getDataLinkType(), is(1)); assertThat(header.getByteOrder(), is(ByteOrder.LITTLE_ENDIAN)); }