@Test public void testFtell() throws Exception { long initialPosition = dumper.ftell(); logger.info("initialPosition: " + initialPosition); dumper.dump(packet); long position = dumper.ftell(); logger.info("position: " + position); assertTrue(position >= initialPosition); assertTrue(position >= packet.length()); }
public long ftell() throws PcapNativeException, NotOpenException { if (!open) { throw new NotOpenException(); } NativeLong nposition; if (!dumperLock.readLock().tryLock()) { throw new NotOpenException(); } try { if (!open) { throw new NotOpenException(); } nposition = NativeMappings.pcap_dump_ftell(dumper); } finally { dumperLock.readLock().unlock(); } long position = nposition.longValue(); if (position < 0) { throw new PcapNativeException("Failed to get the file position."); } return position; }
PcapDumper implements Closeable { public long ftell() throws PcapNativeException, NotOpenException { if (!open) { throw new NotOpenException(); } NativeLong nposition; if (!dumperLock.readLock().tryLock()) { throw new NotOpenException(); } try { if (!open) { throw new NotOpenException(); } nposition = NativeMappings.pcap_dump_ftell(dumper); } finally { dumperLock.readLock().unlock(); } long position = nposition.longValue(); if (position < 0) { throw new PcapNativeException("Failed to get the file position."); } return position; } }
PcapDumper implements Closeable { public long ftell() throws PcapNativeException, NotOpenException { if (!open) { throw new NotOpenException(); } NativeLong nposition; if (!dumperLock.readLock().tryLock()) { throw new NotOpenException(); } try { if (!open) { throw new NotOpenException(); } nposition = NativeMappings.pcap_dump_ftell(dumper); } finally { dumperLock.readLock().unlock(); } long position = nposition.longValue(); if (position < 0) { throw new PcapNativeException("Failed to get the file position."); } return position; } PcapDumper(Pointer dumper, TimestampPrecision timestampPrecision); }
PcapDumper implements Closeable { public long ftell() throws PcapNativeException, NotOpenException { if (!open) { throw new NotOpenException(); } NativeLong nposition; if (!dumperLock.readLock().tryLock()) { throw new NotOpenException(); } try { if (!open) { throw new NotOpenException(); } nposition = NativeMappings.pcap_dump_ftell(dumper); } finally { dumperLock.readLock().unlock(); } long position = nposition.longValue(); if (position < 0) { throw new PcapNativeException("Failed to get the file position."); } return position; } PcapDumper(Pointer dumper, TimestampPrecision timestampPrecision); boolean isOpen(); void dump(Packet packet); void dump(Packet packet, Timestamp timestamp); void dumpRaw(byte[] packet); void dumpRaw(byte[] packet, Timestamp timestamp); void flush(); long ftell(); @Override void close(); }
PcapDumper implements Closeable { public long ftell() throws PcapNativeException, NotOpenException { if (!open) { throw new NotOpenException(); } NativeLong nposition; if (!dumperLock.readLock().tryLock()) { throw new NotOpenException(); } try { if (!open) { throw new NotOpenException(); } nposition = NativeMappings.pcap_dump_ftell(dumper); } finally { dumperLock.readLock().unlock(); } long position = nposition.longValue(); if (position < 0) { throw new PcapNativeException("Failed to get the file position."); } return position; } PcapDumper(Pointer dumper, TimestampPrecision timestampPrecision); boolean isOpen(); void dump(Packet packet); void dump(Packet packet, Timestamp timestamp); void dumpRaw(byte[] packet); void dumpRaw(byte[] packet, Timestamp timestamp); void flush(); long ftell(); @Override void close();  }