public class PcapWriter extends Object implements Closeable, Flushable
| Constructor and Description |
|---|
PcapWriter(I2PAppContext ctx,
String file)Creates a new PcapWriter that writes to the specified file in the log directory. |
| Modifier and Type | Method and Description |
|---|---|
void | close()Closes the output stream, flushing any buffered data. |
void | flush()Flushes any buffered data to the underlying output stream. |
void | write(Packet pkt,
Connection con)Write an inbound packet to the pcap file. |
void | write(PacketLocal pkt)Write an outbound packet to the pcap file. |
public PcapWriter(I2PAppContext ctx, String file) throws IOException
ctx - the application contextfile - the filename to write (relative to the log directory)IOException - if the file cannot be opened or the header cannot be writtenpublic void close()
close in interface Closeableclose in interface AutoCloseablepublic void flush()
public void write(Packet pkt, Connection con) throws IOException
pkt - the inbound packet to writecon - the connection, may be nullIOException - if the packet cannot be writtenpublic void write(PacketLocal pkt) throws IOException
pkt - the outbound packet to writeIOException - if the packet cannot be written