|
|||||||||
| 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.DupPacketOutputStream
public class DupPacketOutputStream
Output stream which duplicates capture file format and contents.
InputStream's original capture file headers are duplicated using the META data mechanism to the output stream. Any META headers extracted from source, are copied as is into the output stream. This class is best used for exact copies between the source and destination streams.
RawformatInputStream in = new RawformatInputStream("capture.pcap", "config/captureformats.npl");
CaptureMetaFormat meta = (CaptureMetaFormat)in; // For explicit demonstration only
DupPacketOutputStream out = new DupPacketOutputStream("dupfile.pcap", meta);
out.copy(in);
To see complete example try running the static main method DupPacketOutputStream.main();
| Field Summary | |
|---|---|
protected CaptureMetaFormat |
metaSource
|
| Fields inherited from class com.voytechs.jnetstream.io.ProtocolDataOutputStream |
|---|
bitsLeft, cachedByte, out |
| Constructor Summary | |
|---|---|
DupPacketOutputStream(java.io.OutputStream out,
CaptureMetaFormat metaSource)
Uses the given output stream to write new capture file, using META headers. |
|
DupPacketOutputStream(java.lang.String file,
CaptureMetaFormat metaSource)
Uses the given file to write new capture file. |
|
| Method Summary | |
|---|---|
void |
copy(PacketInputStream in)
Copy from PacketInputStream to another. |
void |
initPacketStream()
Initialize the PCAP capture file header using META header from META source. |
static void |
main(java.lang.String[] args)
Test function for DupPacketOutputStream Defines two (2) methods of running the class. |
void |
nextPacket()
Initialize the packet header using META data found. |
| 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 |
|---|
close, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected CaptureMetaFormat metaSource
| Constructor Detail |
|---|
public DupPacketOutputStream(java.io.OutputStream out,
CaptureMetaFormat metaSource)
throws java.io.IOException,
StreamFormatException
out - metaSource -
java.io.IOException
StreamFormatException
public DupPacketOutputStream(java.lang.String file,
CaptureMetaFormat metaSource)
throws java.io.FileNotFoundException,
java.io.IOException,
StreamFormatException
file - Filename of the output capture file.metaSource - Source input stream to extract META data from.
java.io.FileNotFoundException - If file can not be opened.
java.io.IOException
StreamFormatException| Method Detail |
|---|
public void initPacketStream()
throws java.io.IOException,
StreamFormatException
initPacketStream in class PacketOutputStreamjava.io.IOException - Any I/O errors.
StreamFormatException - All problems with META data are reported using this
exception.
public void nextPacket()
throws java.io.IOException,
StreamFormatException
java.io.IOException - Any I/O errors.
StreamFormatException - if META is not available of compatible.
public void copy(PacketInputStream in)
throws java.io.IOException,
StreamFormatException
copy in class PacketOutputStreamjava.io.IOException - Any I/O errors.
StreamFormatException - Unexpected end of stream occures.public 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 | ||||||||