KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gnu > lists > CharSeq


1 // Copyright (c) 2001, 2005 Per M.A. Bothner and Brainfood Inc.
2
// This is free software; for terms and warranty disclaimer see ./COPYING.
3

4 package gnu.lists;
5
6 /** A sequence where each element is a character.
7  */

8
9 public interface CharSeq
10   extends
11   /* #ifdef use:java.lang.CharSequence */
12   CharSequence JavaDoc,
13   /* #endif */
14   Sequence
15 {
16   /** Get length of string, in characters.
17    * Synonym for size(), for compatibility with String and StringBuffer. */

18   public int length();
19
20   public char charAt(int index);
21
22   /** Copy characters into a destination buffer.
23    * Same interface as java.lang.String's getChars. */

24   public void getChars (int srcBegin, int srcEnd, char[] dst, int dstBegin);
25
26   public void setCharAt(int index, char ch);
27
28   /** Set all the elements to a given character. */
29   public void fill(char value);
30
31   public void fill(int fromIndex, int toIndex, char value);
32
33   /* #ifdef use:java.lang.CharSequence */
34   public CharSequence JavaDoc subSequence(int start, int end);
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

47   // public void writeTo(Appendable dest)
48
// throws java.io.IOException;
49
/* #else */
50   /**
51    * Write out (part of) this string.
52    * @param start index of initial character to write
53    * @param count number of characters to write
54    * @param dest where to write the characters
55    */

56   public void writeTo(int start, int count, java.io.Writer JavaDoc dest)
57     throws java.io.IOException JavaDoc;
58
59   public void writeTo(java.io.Writer JavaDoc str) throws java.io.IOException JavaDoc;
60   /* #endif */
61
62   public void consume(int start, int count, Consumer out);
63
64   public String JavaDoc toString();
65 }
66
Popular Tags