it.jnrpe.net
Class JNRPERequest

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

public class JNRPERequest
extends Object

This object represent a generic request packet.

Author:
Massimiliano Ziccardi

Constructor Summary
JNRPERequest()
          Creates and empty request.
JNRPERequest(String commandName, String... arguments)
          Inizialize the request with the supplied command and command arguments.
 
Method Summary
 String[] getArguments()
          Returns the command arguments.
 String getCommand()
          Returns the query command.
 PacketVersion getPacketVersion()
          Returns the packet version.
 int getResultCode()
          Returns the result code.
 void setCharset(Charset newCharset)
          Changes the default charset.
 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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JNRPERequest

public JNRPERequest()
Creates and empty request.


JNRPERequest

public JNRPERequest(String commandName,
                    String... arguments)
Inizialize the request with the supplied command and command arguments.

Parameters:
commandName - The command
arguments - The arguments
Method Detail

getCommand

public final String getCommand()
Returns the query command.

Returns:
the query command

getArguments

public final String[] getArguments()
Returns the command arguments.

Returns:
the command arguments

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.