|
|||||||||
| 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
public abstract class PacketOutputStream
Base class for OutputStreams that follow the Packetized structure.
PacketOutputStream is used to output to various CAPTURE stream or file formats,
such as PCAP, SNOOP and other sniffer and protocol analyzer formats.
This stream enforces a structure on the stream where certain information about the capture
streams can be set and then written out. This is a base class for upper layers that implement
CAPTURE format specific OutputStream.
In addition, META data can be exchanged between PacketInputStream and PacketOutputStream
which allows preservation of certain headers between the two. Example of this would be
copying from one PCAP file to another while doing some filtering. The output file would be created
in the same version of the file format as the source, minus any processing in between the two.
The main methods used to write data to this output stream are write() or copy(). The write() method
writes one byte or individual bits at a time into the stream. Also the class extends the
ProtocolDataInputStream base-class that defines write methods for each of the java primitives in
both little and big endian encoding, signed and unsigned variables can written to the output stream.
The copy() is used to copy content from PacketInputStream to the outputstream. Depending which sub-class
is used for the output stream, either the contents can be copied into a different capture file while
changing formats or a straight copy into the same type of capture file.
Note: You will not find nextPacket() in this class. This functionality has been removed from
this base class. Appropriate version of nextPacket() method is not implemented in sub-classes.
DupPacketOutputStream,
CaptureOutputStream| Field Summary |
|---|
| Fields inherited from class com.voytechs.jnetstream.io.ProtocolDataOutputStream |
|---|
bitsLeft, cachedByte, out |
| Constructor Summary | |
|---|---|
PacketOutputStream(java.io.OutputStream out)
Uses the given output stream to write out Packetized stream format. |
|
PacketOutputStream(java.lang.String file)
Uses the given output stream to write out Packetized stream format. |
|
| Method Summary | |
|---|---|
abstract void |
copy(PacketInputStream in)
Copy from PacketInputStream to another. |
protected abstract void |
initPacketStream()
Initializes the main stream or file header. |
static void |
main(java.lang.String[] args)
Test function for PacketOutputStream |
void |
write(int b)
Write a byte of data to the stream. |
| 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 |
|---|
close, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PacketOutputStream(java.io.OutputStream out)
out - OutputStream to write our data.
public PacketOutputStream(java.lang.String file)
throws java.io.FileNotFoundException
java.io.FileNotFoundException| Method Detail |
|---|
protected abstract void initPacketStream()
throws java.io.IOException,
StreamFormatException
java.io.IOException
StreamFormatException
public void write(int b)
throws java.io.IOException
write in class ProtocolDataOutputStreamb - Byte to write to the stream.
java.io.IOException - Any IO errors
public abstract void copy(PacketInputStream in)
throws java.io.IOException,
StreamFormatException
java.io.IOException - Any I/O errors.
EOPacketStream - Unexpected end of stream occures.
PrimitiveException - Any primitive compatibility errors.
StreamFormatExceptionpublic static void main(java.lang.String[] args)
args - command line arguments
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||