44 |
*/ |
*/ |
45 |
|
|
46 |
/** |
/** |
47 |
* This interface is implemented by classes that can wrte data to streams |
* This interface is implemented by classes that can wrte data to streams |
48 |
* from Java primitive types. |
* from Java primitive types. |
49 |
* |
* |
50 |
* @author Aaron M. Renn (arenn@urbanophile.com) |
* @author Aaron M. Renn (arenn@urbanophile.com) |
51 |
* @author Tom Tromey <tromey@cygnus.com> |
* @author Tom Tromey <tromey@cygnus.com> |
52 |
*/ |
*/ |
53 |
public interface DataOutput |
public interface DataOutput |
54 |
{ |
{ |
55 |
|
|
56 |
/** |
/** |
57 |
* This method writes a Java boolean value to an output stream |
* This method writes a Java boolean value to an output stream |
58 |
* |
* |
59 |
* @param value The boolean value to write |
* @param value The boolean value to write |
60 |
* |
* |
61 |
* @exception IOException If an error occurs |
* @exception IOException If an error occurs |
62 |
*/ |
*/ |
63 |
void writeBoolean(boolean value) throws IOException; |
void writeBoolean(boolean value) throws IOException; |
64 |
|
|
|
/*************************************************************************/ |
|
|
|
|
65 |
/** |
/** |
66 |
* This method writes a Java byte value to an output stream |
* This method writes a Java byte value to an output stream |
67 |
* |
* |
68 |
* @param value The int value to write |
* @param value The int value to write |
69 |
* |
* |
70 |
* @exception IOException If an error occurs |
* @exception IOException If an error occurs |
71 |
*/ |
*/ |
72 |
void writeByte(int value) throws IOException; |
void writeByte(int value) throws IOException; |
73 |
|
|
|
/*************************************************************************/ |
|
|
|
|
74 |
/** |
/** |
75 |
* This method writes a Java char value to an output stream |
* This method writes a Java char value to an output stream |
76 |
* |
* |
77 |
* @param value The char value to write |
* @param value The char value to write |
78 |
* |
* |
79 |
* @exception IOException If an error occurs |
* @exception IOException If an error occurs |
80 |
*/ |
*/ |
81 |
void writeChar(int value) throws IOException; |
void writeChar(int value) throws IOException; |
82 |
|
|
|
/*************************************************************************/ |
|
|
|
|
83 |
/** |
/** |
84 |
* This method writes a Java int value to an output stream as a 16 bit value |
* This method writes a Java int value to an output stream as a 16 bit value |
85 |
* |
* |
86 |
* @param value The int value to write as a 16-bit value |
* @param value The int value to write as a 16-bit value |
87 |
* |
* |
88 |
* @exception IOException If an error occurs |
* @exception IOException If an error occurs |
89 |
*/ |
*/ |
90 |
void writeShort(int value) throws IOException; |
void writeShort(int value) throws IOException; |
91 |
|
|
|
/*************************************************************************/ |
|
|
|
|
92 |
/** |
/** |
93 |
* This method writes a Java int value to an output stream |
* This method writes a Java int value to an output stream |
94 |
* |
* |
95 |
* @param value The int value to write |
* @param value The int value to write |
96 |
* |
* |
97 |
* @exception IOException If an error occurs |
* @exception IOException If an error occurs |
98 |
*/ |
*/ |
99 |
void writeInt(int value) throws IOException; |
void writeInt(int value) throws IOException; |
100 |
|
|
|
/*************************************************************************/ |
|
|
|
|
101 |
/** |
/** |
102 |
* This method writes a Java long value to an output stream |
* This method writes a Java long value to an output stream |
103 |
* |
* |
104 |
* @param value The long value to write |
* @param value The long value to write |
105 |
* |
* |
106 |
* @exception IOException If an error occurs |
* @exception IOException If an error occurs |
107 |
*/ |
*/ |
108 |
void writeLong(long value) throws IOException; |
void writeLong(long value) throws IOException; |
109 |
|
|
|
/*************************************************************************/ |
|
|
|
|
110 |
/** |
/** |
111 |
* This method writes a Java float value to an output stream |
* This method writes a Java float value to an output stream |
112 |
* |
* |
113 |
* @param value The float value to write |
* @param value The float value to write |
114 |
* |
* |
115 |
* @exception IOException If an error occurs |
* @exception IOException If an error occurs |
116 |
*/ |
*/ |
117 |
void writeFloat(float value) throws IOException; |
void writeFloat(float value) throws IOException; |
118 |
|
|
|
/*************************************************************************/ |
|
|
|
|
119 |
/** |
/** |
120 |
* This method writes a Java double value to an output stream |
* This method writes a Java double value to an output stream |
121 |
* |
* |
122 |
* @param value The double value to write |
* @param value The double value to write |
123 |
* |
* |
124 |
* @exception IOException If any other error occurs |
* @exception IOException If any other error occurs |
125 |
*/ |
*/ |
126 |
void writeDouble(double value) throws IOException; |
void writeDouble(double value) throws IOException; |
127 |
|
|
|
/*************************************************************************/ |
|
|
|
|
128 |
/** |
/** |
129 |
* This method writes a String to an output stream as an array of bytes |
* This method writes a String to an output stream as an array of bytes |
130 |
* |
* |
131 |
* @param value The String to write |
* @param value The String to write |
132 |
* |
* |
133 |
* @exception IOException If an error occurs |
* @exception IOException If an error occurs |
134 |
*/ |
*/ |
135 |
void writeBytes(String value) throws IOException; |
void writeBytes(String value) throws IOException; |
136 |
|
|
|
/*************************************************************************/ |
|
|
|
|
137 |
/** |
/** |
138 |
* This method writes a String to an output stream as an array of char's |
* This method writes a String to an output stream as an array of char's |
139 |
* |
* |
140 |
* @param value The String to write |
* @param value The String to write |
141 |
* |
* |
142 |
* @exception IOException If an error occurs |
* @exception IOException If an error occurs |
143 |
*/ |
*/ |
144 |
void writeChars(String value) throws IOException; |
void writeChars(String value) throws IOException; |
145 |
|
|
|
/*************************************************************************/ |
|
|
|
|
146 |
/** |
/** |
147 |
* This method writes a String to an output stream encoded in |
* This method writes a String to an output stream encoded in |
148 |
* UTF-8 format. |
* UTF-8 format. |
149 |
* |
* |
150 |
* @param value The String to write |
* @param value The String to write |
151 |
* |
* |
152 |
* @exception IOException If an error occurs |
* @exception IOException If an error occurs |
153 |
*/ |
*/ |
154 |
void writeUTF(String value) throws IOException; |
void writeUTF(String value) throws IOException; |
155 |
|
|
|
/*************************************************************************/ |
|
|
|
|
156 |
/** |
/** |
157 |
* This method writes an 8-bit value (passed into the method as a Java |
* This method writes an 8-bit value (passed into the method as a Java |
158 |
* int) to an output stream. |
* int) to an output stream. |
159 |
* |
* |
160 |
* @param value The byte to write to the output stream |
* @param value The byte to write to the output stream |
161 |
* |
* |
162 |
* @exception IOException If an error occurs |
* @exception IOException If an error occurs |
163 |
*/ |
*/ |
164 |
void write(int value) throws IOException; |
void write(int value) throws IOException; |
165 |
|
|
|
/*************************************************************************/ |
|
|
|
|
166 |
/** |
/** |
167 |
* This method writes the raw byte array passed in to the output stream. |
* This method writes the raw byte array passed in to the output stream. |
168 |
* |
* |
169 |
* @param buf The byte array to write |
* @param buf The byte array to write |
170 |
* |
* |
171 |
* @exception IOException If an error occurs |
* @exception IOException If an error occurs |
172 |
*/ |
*/ |
173 |
void write(byte[] buf) throws IOException; |
void write(byte[] buf) throws IOException; |
174 |
|
|
|
/*************************************************************************/ |
|
|
|
|
175 |
/** |
/** |
176 |
* This method writes raw bytes from the passed array <code>buf</code> |
* This method writes raw bytes from the passed array <code>buf</code> |
177 |
* starting |
* starting |
178 |
* <code>offset</code> bytes into the buffer. The number of bytes |
* <code>offset</code> bytes into the buffer. The number of bytes |
179 |
* written will be * exactly <code>len</code>. |
* written will be * exactly <code>len</code>. |
180 |
* |
* |
181 |
* @param buf The buffer from which to write the data |
* @param buf The buffer from which to write the data |
182 |
* @param offset The offset into the buffer to start writing data from |
* @param offset The offset into the buffer to start writing data from |
183 |
* @param len The number of bytes to write from the buffer to the output |
* @param len The number of bytes to write from the buffer to the output |
184 |
* stream |
* stream |
185 |
* |
* |
186 |
* @exception IOException If any other error occurs |
* @exception IOException If any other error occurs |
187 |
*/ |
*/ |
188 |
void write(byte[] buf, int offset, int len) throws IOException; |
void write(byte[] buf, int offset, int len) throws IOException; |
189 |
|
|
190 |
} // interface DataOutput |
} // interface DataOutput |