Secure iNet Factory

com.jscape.inet.ssh.types
Class SshBoolean

java.lang.Object
  extended by com.jscape.inet.ssh.types.SshBoolean

public final class SshBoolean
extends java.lang.Object

SSH2 boolean type. A boolean value is stored as a single byte. The value 0 represents FALSE, and the value 1 represents TRUE. All non-zero values are interpreted as TRUE.

Version:
1.0
Author:
Alex Usun

Field Summary
static SshBoolean FALSE
          The Boolean object corresponding to the primitive value false.
static int LENGTH
          Type's length in bytes.
static SshBoolean TRUE
          The SSH boolean object corresponding to the primitive value true.
 
Constructor Summary
SshBoolean(boolean value)
          Creates a new SSH boolean instance.
 
Method Summary
 boolean booleanValue()
          Obtains the current value as boolean.
 boolean equals(java.lang.Object o)
          Compares two objects for the logical equality.
 int hashCode()
          Computes object's hash code.
static boolean readBooleanFrom(java.io.InputStream in)
          Reads SSH boolean value from the stream and returns it as Java boolean value.
static SshBoolean readFrom(java.io.InputStream in)
          Reads SSH boolean object from the stream.
static boolean readValue(java.io.InputStream in)
          Reads a value from the specified stream.
 java.lang.String toString()
          Provides object string representation.
static void writeBooleanTo(boolean value, java.io.OutputStream out)
          Writes the specified value to the stream.
 void writeTo(java.io.OutputStream out)
          Writes the current SSH boolean value to the stream.
static void writeValue(boolean value, java.io.OutputStream out)
          Writes the specified value to the stream.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LENGTH

public static final int LENGTH
Type's length in bytes.

See Also:
Constant Field Values

TRUE

public static final SshBoolean TRUE
The SSH boolean object corresponding to the primitive value true.


FALSE

public static final SshBoolean FALSE
The Boolean object corresponding to the primitive value false.

Constructor Detail

SshBoolean

public SshBoolean(boolean value)
Creates a new SSH boolean instance.

Parameters:
value - instance value
Method Detail

readValue

public static boolean readValue(java.io.InputStream in)
                         throws java.io.IOException
Reads a value from the specified stream.

Parameters:
in - input stream
Returns:
read value
Throws:
java.io.IOException - if an I/O error occurs

writeValue

public static void writeValue(boolean value,
                              java.io.OutputStream out)
                       throws java.io.IOException
Writes the specified value to the stream.

Parameters:
value - value to write
out - output stream
Throws:
java.io.IOException - if an I/O error occurs

readBooleanFrom

public static boolean readBooleanFrom(java.io.InputStream in)
                               throws java.io.IOException
Reads SSH boolean value from the stream and returns it as Java boolean value.

Parameters:
in - input stream
Returns:
readed boolean value
Throws:
java.io.IOException - if I/O error occurs

readFrom

public static SshBoolean readFrom(java.io.InputStream in)
                           throws java.io.IOException
Reads SSH boolean object from the stream.

Parameters:
in - input stream
Returns:
readed SSH boolean object
Throws:
java.io.IOException - if I/O error occurs

writeBooleanTo

public static void writeBooleanTo(boolean value,
                                  java.io.OutputStream out)
                           throws java.io.IOException
Writes the specified value to the stream.

Parameters:
value - value to write
out - output stream
Throws:
java.io.IOException - if I/O error occurs

booleanValue

public boolean booleanValue()
Obtains the current value as boolean.

Returns:
the current value as boolean.

toString

public java.lang.String toString()
Provides object string representation.

Overrides:
toString in class java.lang.Object
Returns:
object string representation

equals

public boolean equals(java.lang.Object o)
Compares two objects for the logical equality.

Overrides:
equals in class java.lang.Object
Parameters:
o - object to compare
Returns:
true if objects are logically equal; false otherwise

hashCode

public int hashCode()
Computes object's hash code.

Overrides:
hashCode in class java.lang.Object
Returns:
object's hash code

writeTo

public void writeTo(java.io.OutputStream out)
             throws java.io.IOException
Writes the current SSH boolean value to the stream.

Parameters:
out - output stream
Throws:
java.io.IOException - if I/O error occurs

Secure iNet Factory

Copyright © JSCAPE LLC. 1999-2011. All Rights Reserved