01: // Copyright (c) 2000, 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 Consumer is something that will accept data (output),
07: * and do something with it.
08: * A consumer is like a SAX DocumentHandler or a PrintWriter,
09: * but more abstract. If a Sequence class impleemnts Consumer,
10: * then data "written" to the sequence will be inserted in the sequence.
11: * <p>
12: * <em>Note:</em> This interface is not quite final. For example it is
13: * probable we will add methods for comments, processing instructions, etc.
14: */
15:
16: public interface Consumer {
17: public void writeChar(int v);
18:
19: public void writeBoolean(boolean v);
20:
21: public void writeFloat(float v);
22:
23: public void writeDouble(double v);
24:
25: public void writeInt(int v);
26:
27: public void writeLong(long v);
28:
29: public void beginGroup(String typeName, Object type);
30:
31: public void endGroup(String typeName);
32:
33: /** Write a attribute for the current group.
34: * This is only allowed immediately after a beginGroup. */
35: public void beginAttribute(String attrName, Object attrType);
36:
37: public void endAttribute();
38:
39: public void writeObject(Object v);
40:
41: /** True if consumer is ignoring rest of group.
42: * The producer can use this information to skip ahead. */
43: public boolean ignoring();
44:
45: public void writeChars(String str);
46:
47: // public void writeChars(AbstractString str);
48: public void write(char[] buf, int off, int len);
49: }
50:
51: // This is for people using the Emacs editor:
52: // Local Variables:
53: // c-file-style: "java"
54: // c-file-offsets: ((substatement-open . 0))
55: // tab-width: 4
56: // indent-tabs-mode: t
57: // End:
|