RoboJDETM v2.0

java.lang
Class String

java.lang.Object
  extended by java.lang.String

public class String
extends Object

An object representing an immutable character string.

This implementation uses an ASCII representation internally. It does not support unicode strings.


Constructor Summary
String()
          Constructs a String object of zero length.
String(byte[] bytes)
          Constructs a String object from the provided byte array assuming the array contains ASCII data.
String(byte[] bytes, int offset, int length)
          Constructs a String object from the provided byte array assuming the array contains ASCII data.
String(char[] chars)
          Constructs a String object from characters in the provided character array assuming the characters are ASCII.
String(char[] chars, int offset, int count)
          Constructs a String object from characters in the provided character array assuming the characters are ASCII.
String(String string)
          Constructs a new String object from the provided string object.
 
Method Summary
 boolean equals(Object o)
          Returns true if the specified object is a String of the same characters as this String.
 byte[] getBytes()
          Returns a clone of the ASCII bytes which represent this String.
 void getBytes(int beginIndex, int endIndex, byte[] bytes, int destinationIndex)
          Copies bytes from this string to the specified byte buffer.
 int hashCode()
          Returns a hash code generated from the characters that make up this String.
 int length()
          Returns the count of characters in this String.
 char[] toCharArray()
          Returns a character array containing the characters in this String.
 String toString()
          Returns a pointer to this object.
static String valueOf(Object o)
          Returns toString() of the specified object.
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait
 

Constructor Detail

String

public String()
Constructs a String object of zero length.


String

public String(byte[] bytes)
Constructs a String object from the provided byte array assuming the array contains ASCII data.

Parameters:
bytes - bytes representing the character string

String

public String(byte[] bytes,
              int offset,
              int length)
Constructs a String object from the provided byte array assuming the array contains ASCII data.

Parameters:
bytes - bytes representing the character string
offset - offset of the first byte in the array to use
length - number of bytes to use

String

public String(char[] chars)
Constructs a String object from characters in the provided character array assuming the characters are ASCII.

Parameters:
chars - character array

String

public String(char[] chars,
              int offset,
              int count)
Constructs a String object from characters in the provided character array assuming the characters are ASCII.

Parameters:
chars - character array
offset - offset of the first character in the array to use
count - number of characters to use

String

public String(String string)
Constructs a new String object from the provided string object.

Parameters:
string - a String object
Method Detail

equals

public boolean equals(Object o)
Returns true if the specified object is a String of the same characters as this String.

Overrides:
equals in class Object
Parameters:
o - object to compare to
Returns:
true if both objects represent the same character sequence, otherwise false

getBytes

public byte[] getBytes()
Returns a clone of the ASCII bytes which represent this String.

Returns:
ASCII bytes

getBytes

public void getBytes(int beginIndex,
                     int endIndex,
                     byte[] bytes,
                     int destinationIndex)
Copies bytes from this string to the specified byte buffer.

Parameters:
beginIndex - starting index in this String
endIndex - ending index in this String
bytes - destination buffer
destinationIndex - starting index into destination buffer

hashCode

public int hashCode()
Returns a hash code generated from the characters that make up this String.

Overrides:
hashCode in class Object
Returns:
hash code

length

public int length()
Returns the count of characters in this String.

Returns:
character count

toCharArray

public char[] toCharArray()
Returns a character array containing the characters in this String.

Returns:
character array

toString

public String toString()
Returns a pointer to this object.

Overrides:
toString in class Object
Returns:
this

valueOf

public static String valueOf(Object o)
Returns toString() of the specified object.

Parameters:
o - object
Returns:
String representation of the object

RoboJDETM v2.0

Copyright (c) 2003-2009 RidgeSoft, LLC. All rights reserved.
www.ridgesoft.com