Secure iNet Factory

com.jscape.inet.ssh.types
Class SshNameList

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

public final class SshNameList
extends java.lang.Object
implements java.lang.Comparable

A string containing a comma separated list of names. A name list is represented as a uint32 containing its length (number of bytes that follow) followed by a comma-separated list of zero or more names. A name must be non-zero length, and it must not contain a comma (','). Context may impose additional restrictions on the names; for example, the names in a list may have to be valid algorithm identifier (see Section 6 below), or [RFC3066] language tags. The order of the names in a list may or may not be significant, also depending on the context where the list is is used. Terminating NUL characters are not used, neither for the individual names, nor for the list as a whole.

Version:
1.0
Author:
Alex Usun

Constructor Summary
SshNameList(java.lang.String[] names)
          Creates a new SSH name list instance.
 
Method Summary
 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.
 java.lang.String getFirstCommonNameFrom(SshNameList that)
          Finds the first name that is common for the current and for the specified lists.
 java.lang.String[] getNames()
          Obtains name list.
 int hashCode()
          Computes object's hash code.
static SshNameList readFrom(java.io.InputStream in)
          Reads name list object from the stream.
static java.lang.String[] readNamesFrom(java.io.InputStream in)
          Reads name list from the stream and returns it as string array.
static byte[] readValue(java.io.InputStream in)
          Reads a value from the specified stream.
static byte[] toByteArray(java.lang.String[] names)
           
 java.lang.String toString()
          Provides object string representation.
static java.lang.String toString(byte[] data)
           
static java.lang.String[] toStringArray(byte[] data)
           
static void writeNamesTo(java.lang.String[] names, java.io.OutputStream out)
          Writes specified name array to the stream.
 void writeTo(java.io.OutputStream out)
          Writes the current SSH names list value to the stream.
static void writeValue(byte[] 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
 

Constructor Detail

SshNameList

public SshNameList(java.lang.String[] names)
Creates a new SSH name list instance.

Parameters:
names - instance names
Method Detail

readValue

public static byte[] 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 a error occurs

writeValue

public static void writeValue(byte[] 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 error occurs

toByteArray

public static byte[] toByteArray(java.lang.String[] names)

toStringArray

public static java.lang.String[] toStringArray(byte[] data)

toString

public static java.lang.String toString(byte[] data)

readNamesFrom

public static java.lang.String[] readNamesFrom(java.io.InputStream in)
                                        throws java.io.IOException
Reads name list from the stream and returns it as string array.

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

readFrom

public static SshNameList readFrom(java.io.InputStream in)
                            throws java.io.IOException
Reads name list object from the stream.

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

writeNamesTo

public static void writeNamesTo(java.lang.String[] names,
                                java.io.OutputStream out)
                         throws java.io.IOException
Writes specified name array to the stream.

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

getNames

public java.lang.String[] getNames()
Obtains name list.

Returns:
name list as array

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

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 names list value to the stream.

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

getFirstCommonNameFrom

public java.lang.String getFirstCommonNameFrom(SshNameList that)
Finds the first name that is common for the current and for the specified lists.

Parameters:
that - name list
Returns:
the first common name
Throws:
java.util.NoSuchElementException - if there's no common names

Secure iNet Factory

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