|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.i2p.data.DataStructureImpl
net.i2p.data.i2cp.I2CPMessageImpl
public abstract class I2CPMessageImpl
Defines the base message implementation.
| Constructor Summary | |
|---|---|
I2CPMessageImpl()
|
|
| Method Summary | |
|---|---|
protected abstract void |
doReadMessage(InputStream buf,
int size)
Read in the payload part of the message (after the initial 4 byte size and 1 byte type) |
protected abstract byte[] |
doWriteMessage()
Write out the payload part of the message (not including the 4 byte size and 1 byte type) |
void |
readBytes(InputStream in)
Load up the current object with data from the given stream. |
void |
readMessage(InputStream in)
Validate the type and size of the message, and then read the message into the data structures. |
void |
readMessage(InputStream in,
int length,
int type)
Read the body into the data structures |
void |
writeBytes(OutputStream out)
Write out the data structure to the stream, using the format defined in the I2P data structure specification. |
void |
writeMessage(OutputStream out)
Write out the full message to the stream, including the 4 byte size and 1 byte type header. |
| Methods inherited from class net.i2p.data.DataStructureImpl |
|---|
calculateHash, fromBase64, fromByteArray, read, toBase64, toByteArray |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface net.i2p.data.i2cp.I2CPMessage |
|---|
getType |
| Methods inherited from interface net.i2p.data.DataStructure |
|---|
calculateHash, fromBase64, fromByteArray, toBase64, toByteArray |
| Constructor Detail |
|---|
public I2CPMessageImpl()
| Method Detail |
|---|
public void readMessage(InputStream in)
throws I2CPMessageException,
IOException
readMessage in interface I2CPMessagein - stream to read from
IOException
I2CPMessageException - if the stream doesn't contain a valid message
that this class can read.
public void readMessage(InputStream in,
int length,
int type)
throws I2CPMessageException,
IOException
readMessage in interface I2CPMessagelength - number of bytes in the message payloadin - stream to read fromtype - type of message (should equal getType())
IOException
I2CPMessageException - if the stream doesn't contain a valid message
that this class can read.
protected abstract void doReadMessage(InputStream buf,
int size)
throws I2CPMessageException,
IOException
buf - InputStreamsize - payload size
I2CPMessageException
IOException
protected abstract byte[] doWriteMessage()
throws I2CPMessageException,
IOException
I2CPMessageException
IOException
public void writeMessage(OutputStream out)
throws I2CPMessageException,
IOException
writeMessage in interface I2CPMessageout - OutputStream
IOException
I2CPMessageException - if the current object doesn't have sufficient data
to write a properly formatted message.
public void readBytes(InputStream in)
throws DataFormatException,
IOException
DataStructure
readBytes in interface DataStructurein - stream to read from
DataFormatException - if the data is improperly formatted
IOException - if there was a problem reading the stream
public void writeBytes(OutputStream out)
throws DataFormatException,
IOException
DataStructure
writeBytes in interface DataStructureout - stream to write to
DataFormatException - if the data was incomplete or not yet ready to be written
IOException - if there was a problem writing to the stream
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||