01: // Copyright (c) 2001 Per M.A. Bothner and Brainfood Inc.
02: // This is free software; for terms and warranty disclaimer see ./COPYING.
03:
04: package gnu.lists;
05:
06: /** A sequence where each element is a character.
07: * Note: It appears that JDK 1.4 will have a new interface
08: * java.lang.CharSequence, with charAt length, subSequence, and toString.
09: */
10:
11: public interface CharSeq extends Sequence {
12: /** Get length of string, in characters.
13: * Synonym for size(), for compatibility with String and StringBuffer. */
14: public int length();
15:
16: public char charAt(int index);
17:
18: /** Copy characters into a destination buffer.
19: * Same interface as java.lang.String's getChars. */
20: public void getChars(int srcBegin, int srcEnd, char[] dst,
21: int dstBegin);
22:
23: public void setCharAt(int index, char ch);
24:
25: /** Set all the elements to a given character. */
26: public void fill(char value);
27:
28: public void fill(int fromIndex, int toIndex, char value);
29:
30: /**
31: * Write out (part of) this string.
32: * @param start index of initial character to write
33: * @param count number of characters to write
34: * @param dest where to write the characters
35: */
36: public void writeTo(int start, int count, java.io.Writer dest)
37: throws java.io.IOException;
38:
39: public void writeTo(java.io.Writer str) throws java.io.IOException;
40:
41: public void consume(int start, int count, Consumer out);
42:
43: public String toString();
44:
45: // JDK 1.4 CharSequence also has:
46: // public CharSequence subSequence (int start, int end);
47: }
|