|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectit.jnrpe.net.JNRPERequest
public class JNRPERequest
This object represent a generic request packet.
| Constructor Summary | |
|---|---|
JNRPERequest(InputStream in)
This constructor initializes the object with the data read from the given input stream. |
|
JNRPERequest(String commandName,
String... arguments)
Inizialize the request with the supplied command and command arguments. |
|
| Method Summary | |
|---|---|
protected void |
_setMessage(String message)
Sets the packet message. |
protected void |
fromInputStream(InputStream in)
Initialize the object reading the data from the input stream. |
int |
getCRC()
Returns the packet CRC value. |
PacketType |
getPacketType()
Returns the packet type. |
PacketVersion |
getPacketVersion()
Returns the packet version. |
int |
getResultCode()
Returns the result code. |
String |
getStringMessage()
Returns the string message. |
protected void |
initRandomBuffer()
Initializes the arrays with random data. |
void |
setCRC(int crc)
Sets the CRC value. |
protected void |
setDataBuffer(String commandName)
Write the command name inside the JNRPE packet. |
protected void |
setPacketType(PacketType packetType)
Sets the packet type. |
void |
setPacketVersion(PacketVersion version)
Sets the packet version. |
void |
setResultCode(int status)
Sets the result code. |
byte[] |
toByteArray()
Converts the packet object to its byte array representation. |
void |
validate()
Validates the packet CRC. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JNRPERequest(InputStream in)
throws IOException,
BadCRCException
in - The stream containing the data to be parsed
IOException - On any IO exception
BadCRCException - If the CRC can't be validated
public JNRPERequest(String commandName,
String... arguments)
commandName - The commandarguments - The arguments| Method Detail |
|---|
public int getCRC()
public PacketType getPacketType()
public PacketVersion getPacketVersion()
public void setCRC(int crc)
crc - The new CRC valueprotected void setPacketType(PacketType packetType)
packetType - The new packet typepublic void setPacketVersion(PacketVersion version)
version - The packet versionpublic int getResultCode()
public void setResultCode(int status)
status - The new result code
protected void fromInputStream(InputStream in)
throws IOException
in - The stream to be read
IOException - On any I/O error
public void validate()
throws BadCRCException
BadCRCException - If the CRC can't be validatedpublic byte[] toByteArray()
public String getStringMessage()
protected void _setMessage(String message)
JNRPEProtocolPacket.MAX_PACKETBUFFER_LENGTH than it gets
truncated to JNRPEProtocolPacket.MAX_PACKETBUFFER_LENGTH bytes.
message - The messageprotected void initRandomBuffer()
protected void setDataBuffer(String commandName)
commandName - The command name
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||