Secure iNet Factory

com.jscape.inet.ssh.types
Class SshUint64

java.lang.Object
  extended by com.jscape.inet.ssh.types.SshUint64
All Implemented Interfaces:
java.lang.Comparable

public class SshUint64
extends java.lang.Object
implements java.lang.Comparable

Represents a 64-bit unsigned integer. Stored as eight bytes in the order of decreasing significance (network byte order).

Version:
1.0
Author:
Alex Usun

Field Summary
static int LENGTH
          Type's length in bytes.
static java.math.BigInteger MAX_VALUE
          A constant holding the maximum value a SSH int64 can have, 264.
static java.math.BigInteger MIN_VALUE
          A constant holding the minimum value a SSH int64 can have, 0.
 
Constructor Summary
SshUint64(java.math.BigInteger value)
          Creates a new SSH uint64 instance.
SshUint64(long value)
          Creates a new SSH uint64 instance.
 
Method Summary
 java.math.BigInteger bigIntegerValue()
          Obtains the current value as big integer.
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
 boolean equals(java.lang.Object o)
          Compares two objects for the logical equality.
 int hashCode()
          Computes object's hash code.
 long longValue()
          Obtains the current value as long.
static java.math.BigInteger readBigIntegerFrom(java.io.InputStream in)
          Reads SSH uint64 value from the stream and returns it as Java big integer.
static SshUint64 readFrom(java.io.InputStream in)
          Reads SSH uint64 object from the stream.
static long readLongFrom(java.io.InputStream in)
          Reads SSH uint64 value from the stream and returns it as Java long value.
static long readValue(java.io.InputStream in)
          Reads a value from the specified stream.
 java.lang.String toString()
          Provides object string representation.
static void writeBigIntegerTo(java.math.BigInteger value, java.io.OutputStream out)
          Writes the specified value to the stream.
static void writeLongTo(long value, java.io.OutputStream out)
          Writes the specified value to the stream.
 void writeTo(java.io.OutputStream out)
          Writes the current SSH uint32 value to the stream.
static void writeValue(long 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

MIN_VALUE

public static final java.math.BigInteger MIN_VALUE
A constant holding the minimum value a SSH int64 can have, 0.


MAX_VALUE

public static final java.math.BigInteger MAX_VALUE
A constant holding the maximum value a SSH int64 can have, 264.


LENGTH

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

See Also:
Constant Field Values
Constructor Detail

SshUint64

public SshUint64(long value)
Creates a new SSH uint64 instance.

Parameters:
value - instance value

SshUint64

public SshUint64(java.math.BigInteger value)
Creates a new SSH uint64 instance.

Parameters:
value - instance value
Method Detail

readValue

public static long 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(long 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

readBigIntegerFrom

public static java.math.BigInteger readBigIntegerFrom(java.io.InputStream in)
                                               throws java.io.IOException
Reads SSH uint64 value from the stream and returns it as Java big integer.

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

readLongFrom

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

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

readFrom

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

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

writeBigIntegerTo

public static void writeBigIntegerTo(java.math.BigInteger 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

writeLongTo

public static void writeLongTo(long 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

bigIntegerValue

public java.math.BigInteger bigIntegerValue()
Obtains the current value as big integer.

Returns:
the current value as big integer.

longValue

public long longValue()
Obtains the current value as long.

Returns:
the current value as long.

toString

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

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

hashCode

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

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

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

compareTo

public int compareTo(java.lang.Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - object to be compared
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

writeTo

public void writeTo(java.io.OutputStream out)
             throws java.io.IOException
Writes the current SSH uint32 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