it.jnrpe.net
Class JNRPEResponse

java.lang.Object
  extended by it.jnrpe.net.JNRPEResponse

public final class JNRPEResponse
extends Object

This object represent a generic response packet.

Author:
Massimiliano Ziccardi

Constructor Summary
JNRPEResponse()
          Default constructor.
JNRPEResponse(InputStream in)
          Builds a JNRPE response reading the content from an InputStream.
 
Method Summary
 String getMessage()
          Returns the response message.
 PacketVersion getPacketVersion()
          Returns the packet version.
 int getResultCode()
          Returns the result code.
 void setCharset(Charset newCharset)
          Changes the default charset.
 void setMessage(String message)
          Sets the message to be included in the response.
 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.
 String toString()
           
 void validate()
          Validates the packet CRC.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JNRPEResponse

public JNRPEResponse()
Default constructor.


JNRPEResponse

public JNRPEResponse(InputStream in)
              throws IOException
Builds a JNRPE response reading the content from an InputStream.

Parameters:
in - The InputStream to read from
Throws:
IOException - on any io exception
Method Detail

setMessage

public void setMessage(String message)
Sets the message to be included in the response.

Parameters:
message - the response message

getMessage

public String getMessage()
Returns the response message.

Returns:
the response message

toString

public String toString()
Overrides:
toString in class Object

getPacketVersion

public PacketVersion getPacketVersion()
Returns the packet version.

Returns:
The packet version

setPacketVersion

public void setPacketVersion(PacketVersion version)
Sets the packet version.

Parameters:
version - The packet version

setCharset

public void setCharset(Charset newCharset)
Changes the default charset.

Parameters:
newCharset - the new charset,

getResultCode

public int getResultCode()
Returns the result code.

Returns:
The result code

setResultCode

public void setResultCode(int status)
Sets the result code.

Parameters:
status - The new result code

validate

public void validate()
              throws BadCRCException
Validates the packet CRC.

Throws:
BadCRCException - If the CRC can't be validated

toByteArray

public byte[] toByteArray()
Converts the packet object to its byte array representation.

Returns:
The byte array representation of this packet.


Copyright © 2014. All Rights Reserved.