public class PacketDumper extends Object implements PacketListener
Modifier and Type | Class and Description |
---|---|
static class |
PacketDumper.PacketType
High level representation of packet types (e.g.
|
Modifier and Type | Field and Description |
---|---|
private boolean |
disabled |
private Map<Class<? extends BasicPacket>,DataOutputStream> |
dumpFiles |
private String |
fileNamePattern |
private static Logger |
log |
private File |
logDirectory |
Constructor and Description |
---|
PacketDumper(File logDirectory,
String fileNamePattern) |
Modifier and Type | Method and Description |
---|---|
private void |
closeFile(OutputStream stream,
PacketDumper.PacketType packetType) |
void |
dumpPackets(PacketDumper.PacketType packetType,
boolean on) |
private DataOutputStream |
getOutputStream(BasicPacket packet) |
private void |
handlePacket(FS4Channel channel,
BasicPacket packet,
ByteBuffer serializedForm,
String direction) |
private void |
hexDump(String indent,
DataOutputStream stream,
ByteBuffer serializedForm) |
private void |
openFile(PacketDumper.PacketType packetType) |
void |
packetReceived(FS4Channel channel,
BasicPacket packet,
ByteBuffer serializedForm) |
void |
packetSent(FS4Channel channel,
BasicPacket packet,
ByteBuffer serializedForm) |
private static Logger log
private volatile boolean disabled
private final File logDirectory
private final Map<Class<? extends BasicPacket>,DataOutputStream> dumpFiles
private final String fileNamePattern
private void handlePacket(FS4Channel channel, BasicPacket packet, ByteBuffer serializedForm, String direction)
private void hexDump(String indent, DataOutputStream stream, ByteBuffer serializedForm) throws IOException
IOException
private DataOutputStream getOutputStream(BasicPacket packet)
public void packetSent(FS4Channel channel, BasicPacket packet, ByteBuffer serializedForm)
packetSent
in interface PacketListener
public void packetReceived(FS4Channel channel, BasicPacket packet, ByteBuffer serializedForm)
packetReceived
in interface PacketListener
public void dumpPackets(PacketDumper.PacketType packetType, boolean on) throws IOException
IOException
private void openFile(PacketDumper.PacketType packetType) throws FileNotFoundException
FileNotFoundException
private void closeFile(OutputStream stream, PacketDumper.PacketType packetType) throws IOException
IOException
Copyright © 2017. All rights reserved.