|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectit.jnrpe.net.JNRPEResponse
public final class JNRPEResponse
This object represent a generic response packet.
| Constructor Summary | |
|---|---|
JNRPEResponse()
Default constructor. |
|
JNRPEResponse(InputStream in)
Builds a JNRPE response reading the content from an InputStream. |
|
| 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. |
void |
setMessage(String message)
Sets the message to be included in the response. |
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 |
updateCRC()
Updates the CRC value. |
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 JNRPEResponse()
public JNRPEResponse(InputStream in)
throws IOException
in - The InputStream to read from
IOException - on any io exception| Method Detail |
|---|
public void updateCRC()
public void setMessage(String message)
message - the response messagepublic 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 | |||||||||