net.tomp2p.peers
Class ShortString
java.lang.Object
  
net.tomp2p.peers.ShortString
- All Implemented Interfaces: 
 - Comparable<ShortString>
 
public final class ShortString
- extends Object
- implements Comparable<ShortString>
  
A short string stores strings with length of up to 19 characters. The length is content by the encoded string using
 UTF-8. Fill always two variables, the encoded string and the string itself. Although this seems to be a waste of
 space, the java.lang.string is backed by a char[], thus, if we use this, we might only store string with length 16.
 These strings (at least in English) will have lots of zeros.
- Author:
 
  - Thomas Bocek
 
| 
Constructor Summary | 
ShortString(Number160 number160)
 
          Creates a short string, decodes the byte array from UTF-8 and checks for its length | 
ShortString(String s1)
 
          Creates a short string, encodes string in UTF-8 and checks for its length | 
 
 
 
ShortString
public ShortString(String s1)
- Creates a short string, encodes string in UTF-8 and checks for its length
- Parameters:
 s1 - The string
- Throws:
 UnsupportedEncodingException - if UTF-8 is not available. If this is the case, then we have a problem...
 
ShortString
public ShortString(Number160 number160)
            throws UnsupportedEncodingException
- Creates a short string, decodes the byte array from UTF-8 and checks for its length
- Parameters:
 me - The byte array
- Throws:
 UnsupportedEncodingException - If this is the case, then we have a problem...
 
toNumber160
public Number160 toNumber160()
 
 
toString
public String toString()
- Overrides:
 toString in class Object
 
 
equals
public boolean equals(Object obj)
- Overrides:
 equals in class Object
 
 
compareTo
public int compareTo(ShortString o)
- Specified by:
 compareTo in interface Comparable<ShortString>
 
 
Copyright © 2013. All Rights Reserved.