| java.lang.Object com.sun.midp.lcdui.DynamicCharacterArray
DynamicCharacterArray | public class DynamicCharacterArray (Code) | | Similar to StringBuffer but does NOT resize when needed, only when
requested
|
Field Summary | |
protected char | buffer buffer to store data. | protected int | length |
Method Summary | |
public void | append(char c) Appends a character onto the end of the buffer. | public int | capacity() | public char | charAt(int index) | public void | delete(int offset, int del_length) | public void | get(char[] data) Returns the internal buffer in the array provided. | public void | getChars(int position, int get_length, char[] data, int offset) Returns the internal buffer in the array provided. | public int | insert(char[] data, int offset, int ins_length, int position) Inserts an subset of an array into the buffer. | public int | insert(int position, char ch) Inserts an character into the buffer. | public int | insert(int position, String str) Inserts an String into the buffer. | public int | length() | public void | set(char[] data, int offset, int set_length) Sets the internal buffer to the values of the subset specified
The offset parameter must be within the range [0..(size())], inclusive.
The length parameter must be a non-negative integer such that
(offset + length) <= size(). | public void | setCapacity(int capacity) Sets the maximum capacity to the specified value. | public void | setCharAt(int index, char ch) | public char[] | toCharArray() Returns a copy of the active portion of the internal buffer. | public String | toString() |
buffer | protected char buffer(Code) | | buffer to store data. The capacity of this DynamicCharacterArray
is equal to the length of this buffer
|
length | protected int length(Code) | | the length of the array currently in use
|
DynamicCharacterArray | public DynamicCharacterArray(int capacity)(Code) | | Initializes the DCA with a capacity and an empty array
Parameters: capacity - the maximum storage capacity throws: IllegalArgumentException - if capacity <= 0 throws: IllegalArgumentException - if data.length > capacity |
DynamicCharacterArray | public DynamicCharacterArray(String str)(Code) | | Initializes the array with str and a capacity of str.length()
Parameters: str - initial array data, may NOT be null throws: NullPointerException - if str is null |
DynamicCharacterArray | public DynamicCharacterArray(char[] data)(Code) | | Initializes the array with data and a capacity of data.length
Parameters: data - initial array data, may NOT be null throws: NullPointerException - if data is null |
DynamicCharacterArray | public DynamicCharacterArray(char[] data, int capacity)(Code) | | Initializes the array with data and a capacity of capacity
Parameters: data - initial array data, may be null Parameters: capacity - initial maximum capacity throws: IllegalArgumentException - if capacity <= 0 throws: IllegalArgumentException - if data.length > capacity |
append | public void append(char c)(Code) | | Appends a character onto the end of the buffer.
Parameters: c - character to append throws: IllegalArgumentException - if the resulting array would exceedthe capacity |
capacity | public int capacity()(Code) | | Returns the current capacity
the maximum capacity |
charAt | public char charAt(int index)(Code) | | Returns the character at the specified index of the internal buffer
Parameters: index - index into the buffer the character at the specified index throws: IndexOutOfBoundsException - if the 0 < index or index > length() |
delete | public void delete(int offset, int del_length)(Code) | | Deletes the specified range from the internal buffer
Parameters: offset - offset to begin deleting Parameters: del_length - length of portion to delete throws: StringIndexOutOfBoundsException - if offset and length donot specific a valid range in the internal buffer |
get | public void get(char[] data)(Code) | | Returns the internal buffer in the array provided. This must
be at least length() long.
Parameters: data - array to fill with the character of the internal buffer throws: IndexOutOfBoundsException - if data cannot hold the contents throws: NullPointerException - if data is null |
getChars | public void getChars(int position, int get_length, char[] data, int offset)(Code) | | Returns the internal buffer in the array provided.
Parameters: position - index into the internal buffer to start copying Parameters: get_length - length of region to copy Parameters: data - array to fill with the character of the internal buffer Parameters: offset - offset into data to copy to throws: IndexOutOfBoundsException - if data cannot hold the contents throws: NullPointerException - if data is null |
insert | public int insert(char[] data, int offset, int ins_length, int position)(Code) | | Inserts an subset of an array into the buffer.
The offset parameter must be within the range [0..(size())], inclusive.
The length parameter must be a non-negative integer such that
(offset + length) <= size().
Parameters: data - array to insert Parameters: offset - offset into data Parameters: ins_length - length of subset Parameters: position - index into the internal buffer to insert the subset the actual position the data was inserted throws: ArrayIndexOutOfBoundsException - if offset and lengthspecify an invalid range throws: IllegalArgumentException - if the resulting array would exceedthe capacity throws: NullPointerException - if data is null |
insert | public int insert(int position, char ch)(Code) | | Inserts an character into the buffer.
Parameters: ch - character to insert Parameters: position - index into the internal buffer to insert the subset the actual position the data was inserted throws: IllegalArgumentException - if the resulting array would exceedthe capacity |
insert | public int insert(int position, String str)(Code) | | Inserts an String into the buffer.
Parameters: str - String to insert Parameters: position - index into the internal buffer to insert the subset the actual position the data was inserted throws: ArrayIndexOutOfBoundsException - if offset and lengthspecify an invalid range throws: IllegalArgumentException - if the resulting array would exceedthe capacity throws: NullPointerException - if data is null |
length | public int length()(Code) | | Returns the length of current data
current length |
set | public void set(char[] data, int offset, int set_length)(Code) | | Sets the internal buffer to the values of the subset specified
The offset parameter must be within the range [0..(size())], inclusive.
The length parameter must be a non-negative integer such that
(offset + length) <= size(). If data is null the buffer is emptied.
Parameters: data - the data to use to set the buffer Parameters: offset - offset into data Parameters: set_length - length of the subset throws: ArrayIndexOutOfBoundsException - if offset and lengthspecify an invalid range throws: IllegalArgumentException - if length exceeds the capacity |
setCapacity | public void setCapacity(int capacity)(Code) | | Sets the maximum capacity to the specified value. the buffer may
be truncated if the new capacity is less than the current capacity.
Parameters: capacity - new maximum capacity throws: IllegalArgumentException - is zero or less |
setCharAt | public void setCharAt(int index, char ch)(Code) | | Sets the character at index to ch
Parameters: index - index into the buffer Parameters: ch - character to set to throws: IndexOutOfBoundsException - if the 0 < index or index > length() |
toCharArray | public char[] toCharArray()(Code) | | Returns a copy of the active portion of the internal buffer.
character array |
toString | public String toString()(Code) | | Return a String representation of the internal buffer
a String object |
|
|