|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.OutputStream
com.voytechs.jnetstream.io.ProtocolDataOutputStream
com.voytechs.jnetstream.io.PacketOutputStream
com.voytechs.jnetstream.io.CaptureOutputStream
com.voytechs.jnetstream.io.SnoopOutputStream
public class SnoopOutputStream
Output stream which writes out a capture file in PCAP format.
If the InputStream is also a PCAP stream, then all original PCAP header information is
copied into the new OutputStream. Otherwise all parameters of the new SnoopOutputStream
are created from scratch (i.e. the latest support file format, instead of the original version
of PCAP found in InputStream.)
PacketInputStream in = new SnoopInputStream("oldfile.pcap");
PacketOutputStream out = new SnoopOutputStream("newfile.pcap", in); // get META from 'in'
| Field Summary | |
|---|---|
static int |
DEFAULT_PAD_VALUE
|
static int |
DL_CHANNEL
IBM Channel-to-channel |
static int |
DL_CHARACTER
Character Synchronous |
static int |
DL_ETHERNET
Ethernet II. |
static int |
DL_FDDI
FDDI |
static int |
DL_HDCL
HDLC |
static int |
DL_IEEE_802dot3
IEEE 802.3 Ethernet |
static int |
DL_IEEE_802dot4
IEEE 802.4 Token bus. |
static int |
DL_IEEE_802dot5
IEEE 802.5 Token ring. |
static int |
DL_IEEE_802dot6
IEEE 802.6 Metro net. |
static int |
DL_OTHER
other |
protected static java.lang.String |
FORMAT_NAME
|
static long |
SNOOP_MAGIC_NUMBER
|
static int |
SNOOP_RECORD_HEADER_LENGTH
|
| Fields inherited from class com.voytechs.jnetstream.io.ProtocolDataOutputStream |
|---|
bitsLeft, cachedByte, out |
| Constructor Summary | |
|---|---|
SnoopOutputStream(java.io.OutputStream out)
Uses the given output stream to write new capture file. |
|
SnoopOutputStream(java.lang.String file)
uses the given file to write new capture file. |
|
| Method Summary | |
|---|---|
void |
close()
Finish writting data to the output stream. |
void |
finalize()
Catch the stream closing so we can finalize writting of the remainder padding. |
void |
initPacketStream()
Write out the main capture file header into the capture stream. |
static void |
main(java.lang.String[] args)
Test function for SnoopOutputStream |
protected void |
writeRecordHeader(long captureSecs,
int captureNanos,
long snaplen,
long originalLength)
Write out the record header into the capture stream. |
| Methods inherited from class com.voytechs.jnetstream.io.CaptureOutputStream |
|---|
copy, nextPacket, nextPacket |
| Methods inherited from class com.voytechs.jnetstream.io.PacketOutputStream |
|---|
write |
| Methods inherited from class com.voytechs.jnetstream.io.ProtocolDataOutputStream |
|---|
flush, unloadCachedByte, write, write, write, writeByte, writeInt, writeL, writeLByte, writeLInt, writeLLong, writeLong, writeLShort, writeShort, writeUByte, writeUInt, writeULByte, writeULInt, writeULLong, writeULong, writeULShort, writeUShort |
| Methods inherited from class java.io.OutputStream |
|---|
write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String FORMAT_NAME
public static final int DEFAULT_PAD_VALUE
public static final int SNOOP_RECORD_HEADER_LENGTH
public static final long SNOOP_MAGIC_NUMBER
public static final int DL_IEEE_802dot3
public static final int DL_IEEE_802dot4
public static final int DL_IEEE_802dot5
public static final int DL_IEEE_802dot6
public static final int DL_ETHERNET
public static final int DL_HDCL
public static final int DL_CHARACTER
public static final int DL_CHANNEL
public static final int DL_FDDI
public static final int DL_OTHER
| Constructor Detail |
|---|
public SnoopOutputStream(java.io.OutputStream out)
throws java.io.IOException,
StreamFormatException
out - Output stream to new capture file.
java.io.IOException
StreamFormatException
public SnoopOutputStream(java.lang.String file)
throws java.io.FileNotFoundException,
java.io.IOException,
StreamFormatException
file - Filename of the output capture file.
FileNotFound - If file can not be opened.
java.io.FileNotFoundException
java.io.IOException
StreamFormatException| Method Detail |
|---|
public void initPacketStream()
throws java.io.IOException
initPacketStream in class CaptureOutputStreamjava.io.IOException - Any I/O errors while writting the header.
protected void writeRecordHeader(long captureSecs,
int captureNanos,
long snaplen,
long originalLength)
throws java.io.IOException
writeRecordHeader in class CaptureOutputStreamjava.io.IOException - Any I/O errors while writting the header.
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in class CaptureOutputStreamjava.io.IOException - Any I/O errors.public void finalize()
finalize in class java.lang.Object#finish()public static void main(java.lang.String[] args)
args - First argument is a file name of the input capture file.
Second argument (optinal)is the output file name.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||