|
|||||||||
| 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
public abstract class CaptureOutputStream
Base abstract class for all Capture file specific *OutputStream objects.
This method is provides generic interfaces and algorithms to help support
writting of new capture file.
Main methods are write(), any of the write methods defined in ProtocolDataOutputStream
to write native java types or the copy method which is used to copy contents from
one capture file to another, possibly in a nother capture format completely.
Important note: Its is very important to call close() when done writting
data out to the stream. This finalizes the stream and writes out any remaining padding
and headers to the stream before closing it. Without an explicit call to close() last
record written may be incomplete.
| Field Summary |
|---|
| Fields inherited from class com.voytechs.jnetstream.io.ProtocolDataOutputStream |
|---|
bitsLeft, cachedByte, out |
| Constructor Summary | |
|---|---|
CaptureOutputStream(java.io.OutputStream out)
Uses the given output stream to write new capture file. |
|
CaptureOutputStream(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 |
copy(PacketInputStream in)
Copy from PacketInputStream to another. |
protected abstract void |
initPacketStream()
Write out the main capture file header into the capture stream. |
static void |
main(java.lang.String[] args)
Test function for CaptureOutputStream |
void |
nextPacket(long captureMillis,
int captureNanos,
long snaplen,
long length)
Initiializes the capture file header. |
void |
nextPacket(PacketInputStream in)
Initiializes the capture file header. |
protected abstract void |
writeRecordHeader(long captureMillis,
int captureNanos,
long snaplen,
long length)
Writes the capture file record header. |
| 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, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CaptureOutputStream(java.io.OutputStream out)
throws java.io.IOException,
StreamFormatException
out - Output stream to new capture file.
java.io.IOException
StreamFormatException
public CaptureOutputStream(java.lang.String file)
throws java.io.FileNotFoundException,
java.io.IOException,
StreamFormatException
file -
java.io.FileNotFoundException
java.io.IOException
StreamFormatException| Method Detail |
|---|
protected abstract void initPacketStream()
throws java.io.IOException,
StreamFormatException
initPacketStream in class PacketOutputStreamjava.io.IOException - Any I/O errors while writting the header.
StreamFormatException
protected abstract void writeRecordHeader(long captureMillis,
int captureNanos,
long snaplen,
long length)
throws java.io.IOException
captureMillis - captureNanos - snaplen - length -
java.io.IOException
public void nextPacket(PacketInputStream in)
throws java.io.IOException
in - InputStream to extract certain information from about then next packet.
java.io.IOException - Any I/O errors.nextPacket(long captureMillis, int captureNanos, long snaplen, long length)
public void nextPacket(long captureMillis,
int captureNanos,
long snaplen,
long length)
throws java.io.IOException
captureMillis - Number of milli seconds from 1970 when packet was captured.captureNanos - Number nano seconds as additional time fragment in the capture timestamp.snaplen - Number of bytes captured in the packet.length - Number of bytes in the original packet, may differ from snaplen.
java.io.IOException - Any I/O errors.
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in class java.io.OutputStreamjava.io.IOException - Any I/O errors.
public void copy(PacketInputStream in)
throws java.io.IOException,
StreamFormatException
copy in class PacketOutputStreamin - PacketInputStream to use as source of the copy operation.
java.io.IOException - Any I/O 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 | ||||||||