01: // Copyright (c) 2001, 2005 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: */
08:
09: public interface CharSeq extends
10: /* #ifdef use:java.lang.CharSequence */
11: CharSequence,
12: /* #endif */
13: Sequence {
14: /** Get length of string, in characters.
15: * Synonym for size(), for compatibility with String and StringBuffer. */
16: public int length();
17:
18: public char charAt(int index);
19:
20: /** Copy characters into a destination buffer.
21: * Same interface as java.lang.String's getChars. */
22: public void getChars(int srcBegin, int srcEnd, char[] dst,
23: int dstBegin);
24:
25: public void setCharAt(int index, char ch);
26:
27: /** Set all the elements to a given character. */
28: public void fill(char value);
29:
30: public void fill(int fromIndex, int toIndex, char value);
31:
32: /* #ifdef use:java.lang.CharSequence */
33: public CharSequence subSequence(int start, int end);
34:
35: /* #endif */
36:
37: /* #ifdef JAVA5 */
38: // /** Append a specified subsequence to an <code>Appendable</code>.
39: // * An allowable implementation is:
40: // * <code>dest.append(this, start, start+count)</code>.
41: // * Hence implementors of <code>Appendable</code> should avoid calling
42: // * <code>writeTo</code> - though they can call <code>getChars</code>.
43: // */
44: // public void writeTo(int start, int count, Appendable dest)
45: // throws java.io.IOException;
46: // public void writeTo(Appendable dest)
47: // throws java.io.IOException;
48: /* #else */
49: /**
50: * Write out (part of) this string.
51: * @param start index of initial character to write
52: * @param count number of characters to write
53: * @param dest where to write the characters
54: */
55: public void writeTo(int start, int count, java.io.Writer dest)
56: throws java.io.IOException;
57:
58: public void writeTo(java.io.Writer str) throws java.io.IOException;
59:
60: /* #endif */
61:
62: public void consume(int start, int count, Consumer out);
63:
64: public String toString();
65: }
|