/[classpath]/classpath/java/io/DataInput.java
ViewVC logotype

Diff of /classpath/java/io/DataInput.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by mkoch, Sun Mar 23 10:53:29 2003 UTC revision 1.11 by arenn, Sun Apr 6 20:43:57 2003 UTC
# Line 84  public interface DataInput Line 84  public interface DataInput
84     * @exception EOFException If end of file is reached before reading the byte     * @exception EOFException If end of file is reached before reading the byte
85     * @exception IOException If any other error occurs     * @exception IOException If any other error occurs
86     *     *
87     * @see DataOutput     * @see DataOutput#writeBoolean
88     */     */
89    byte readByte() throws EOFException, IOException;    byte readByte() throws EOFException, IOException;
90    
# Line 94  public interface DataInput Line 94  public interface DataInput
94     * <p>     * <p>
95     * This method can read an unsigned byte written by an object     * This method can read an unsigned byte written by an object
96     * implementing the     * implementing the
97     * <code>writeUnsignedByte()</code> method in the <code>DataOutput</code>     * <code>writeByte()</code> method in the <code>DataOutput</code>
98     * interface.     * interface.
99     *     *
100     * @return The unsigned bytes value read as a Java <code>int</code>.     * @return The unsigned bytes value read as a Java <code>int</code>.
# Line 102  public interface DataInput Line 102  public interface DataInput
102     * @exception EOFException If end of file is reached before reading the value     * @exception EOFException If end of file is reached before reading the value
103     * @exception IOException If any other error occurs     * @exception IOException If any other error occurs
104     *     *
105     * @see DataOutput     * @see DataOutput#writeByte
106     */     */
107    int readUnsignedByte() throws EOFException, IOException;    int readUnsignedByte() throws EOFException, IOException;
108    
# Line 128  public interface DataInput Line 128  public interface DataInput
128     * @exception EOFException If end of file is reached before reading the char     * @exception EOFException If end of file is reached before reading the char
129     * @exception IOException If any other error occurs     * @exception IOException If any other error occurs
130     *     *
131     * @see DataOutput     * @see DataOutput#writeChar
132     */     */
133    char readChar() throws EOFException, IOException;    char readChar() throws EOFException, IOException;
134    
# Line 143  public interface DataInput Line 143  public interface DataInput
143     * first and second byte read from the stream respectively, they will be     * first and second byte read from the stream respectively, they will be
144     * transformed to a <code>short</code> in the following manner:     * transformed to a <code>short</code> in the following manner:
145     * <p>     * <p>
146     * <code>(short)((byte1 << 8) + byte2)</code>     * <code>(short)((byte1 << 8) + (byte2 & 0xFF))</code>
147     * <p>     * <p>
148     * The value returned is in the range of -32768 to 32767.     * The value returned is in the range of -32768 to 32767.
149     * <p>     * <p>
# Line 157  public interface DataInput Line 157  public interface DataInput
157     * @exception EOFException If end of file is reached before reading the value     * @exception EOFException If end of file is reached before reading the value
158     * @exception IOException If any other error occurs     * @exception IOException If any other error occurs
159     *     *
160     * @see DataOutput     * @see DataOutput#writeShort
161     */     */
162    short readShort() throws EOFException, IOException;    short readShort() throws EOFException, IOException;
163    
# Line 172  public interface DataInput Line 172  public interface DataInput
172     * first and second byte read from the stream respectively, they will be     * first and second byte read from the stream respectively, they will be
173     * transformed to an <code>int</code> in the following manner:     * transformed to an <code>int</code> in the following manner:
174     * <p>     * <p>
175     * <code>(int)((byte1 << 8) + byte2)</code>     * <code>(int)(((byte1 0xFF) << 8) + (byte2 & 0xFF))</code>
176     * <p>     * <p>
177     * The value returned is in the range of 0 to 65535.     * The value returned is in the range of 0 to 65535.
178     * <p>     * <p>
179     * This method can read an unsigned short written by an object implementing     * This method can read an unsigned short written by an object implementing
180     * the <code>writeUnsignedShort()</code> method in the     * the <code>writeShort()</code> method in the
181     * <code>DataOutput</code>     * <code>DataOutput</code>
182     * interface.     * interface.
183     *     *
# Line 186  public interface DataInput Line 186  public interface DataInput
186     * @exception EOFException If end of file is reached before reading     * @exception EOFException If end of file is reached before reading
187     * the value     * the value
188     * @exception IOException If any other error occurs     * @exception IOException If any other error occurs
189       *
190       * @see DataOutput#writeShort
191     */     */
192    int readUnsignedShort() throws EOFException, IOException;    int readUnsignedShort() throws EOFException, IOException;
193    
# Line 200  public interface DataInput Line 202  public interface DataInput
202     * the first four bytes read from the stream, they will be     * the first four bytes read from the stream, they will be
203     * transformed to an <code>int</code> in the following manner:     * transformed to an <code>int</code> in the following manner:
204     * <p>     * <p>
205     * <code>(int)((byte1 << 24) + (byte2 << 16) + (byte3 << 8) + byte4))</code>     * <code>(int)(((byte1 & 0xFF) << 24) + ((byte2 & 0xFF) << 16) +
206       * ((byte3 & 0xFF)<< 8) + (byte4 & 0xFF)))</code>
207     * <p>     * <p>
208     * The value returned is in the range of -2147483648 to 2147483647.     * The value returned is in the range of -2147483648 to 2147483647.
209     * <p>     * <p>
# Line 213  public interface DataInput Line 216  public interface DataInput
216     * @exception EOFException If end of file is reached before reading the int     * @exception EOFException If end of file is reached before reading the int
217     * @exception IOException If any other error occurs     * @exception IOException If any other error occurs
218     *     *
219     * @see DataOutput     * @see DataOutput#writeInt
220     */     */
221    int readInt() throws EOFException, IOException;    int readInt() throws EOFException, IOException;
222    
# Line 228  public interface DataInput Line 231  public interface DataInput
231     * the first eight bytes read from the stream, they will be     * the first eight bytes read from the stream, they will be
232     * transformed to an <code>long</code> in the following manner:     * transformed to an <code>long</code> in the following manner:
233     * <p>     * <p>
234     * <code>(long)((byte1 << 56) + (byte2 << 48) + (byte3 << 40) +     * <code>(long)(((byte1 & 0xFF) << 56) + ((byte2 & 0xFF) << 48) +
235     * (byte4 << 32) + (byte5 << 24) + (byte6 << 16) + (byte7 << 8) + byte9))     * ((byte3 & 0xFF) << 40) + ((byte4 & 0xFF) << 32) +
236       * ((byte5 & 0xFF) << 24) + ((byte6 & 0xFF) << 16) +
237       * ((byte7 & 0xFF) << 8) + (byte9 & 0xFF)))
238     * </code>     * </code>
239     * <p>     * <p>
240     * The value returned is in the range of -9223372036854775808 to     * The value returned is in the range of -9223372036854775808 to
# Line 244  public interface DataInput Line 249  public interface DataInput
249     * @exception EOFException If end of file is reached before reading the long     * @exception EOFException If end of file is reached before reading the long
250     * @exception IOException If any other error occurs     * @exception IOException If any other error occurs
251     *     *
252     * @see DataOutput     * @see DataOutput#writeLong
253     */     */
254    long readLong() throws EOFException, IOException;    long readLong() throws EOFException, IOException;
255    
# Line 267  public interface DataInput Line 272  public interface DataInput
272     * float     * float
273     * @exception IOException If any other error occurs     * @exception IOException If any other error occurs
274     *     *
275     * @see java.lang.Float     * @see DataOutput#writeFloat
276     * @see DataOutput     * @see java.lang.Float#intBitsToFloat
277     */     */
278    float readFloat() throws EOFException, IOException;    float readFloat() throws EOFException, IOException;
279    
# Line 290  public interface DataInput Line 295  public interface DataInput
295     * double     * double
296     * @exception IOException If any other error occurs     * @exception IOException If any other error occurs
297     *     *
298     * @see java.lang.Double     * @see DataOutput#writeDouble
299     * @see DataOutput     * @see java.lang.Double#longBitsToDouble
300     */     */
301    double readDouble() throws EOFException, IOException;    double readDouble() throws EOFException, IOException;
302    
# Line 309  public interface DataInput Line 314  public interface DataInput
314     * A line terminator is a byte sequence consisting of either     * A line terminator is a byte sequence consisting of either
315     * <code>\r</code>, <code>\n</code> or <code>\r\n</code>.  These termination     * <code>\r</code>, <code>\n</code> or <code>\r\n</code>.  These termination
316     * charaters are discarded and are not returned as part of the string.     * charaters are discarded and are not returned as part of the string.
317       * A line is also terminated by an end of file condition.
318     * <p>     * <p>
319     * This method can read data that was written by an object implementing the     * This method can read data that was written by an object implementing the
320     * <code>writeLine()</code> method in <code>DataOutput</code>.     * <code>writeLine()</code> method in <code>DataOutput</code>.
# Line 317  public interface DataInput Line 323  public interface DataInput
323     *     *
324     * @exception IOException If an error occurs     * @exception IOException If an error occurs
325     *     *
326     * @see DataOutput     * @see DataOutput#writeLine
327     */     */
328    String readLine() throws IOException;    String readLine() throws IOException;
329    
# Line 390  public interface DataInput Line 396  public interface DataInput
396     * @exception UTFDataFormatException If the data is not in UTF-8 format     * @exception UTFDataFormatException If the data is not in UTF-8 format
397     * @exception IOException If any other error occurs     * @exception IOException If any other error occurs
398     *     *
399     * @see DataOutput     * @see DataOutput#writeUTF
400     */     */
401    String readUTF() throws EOFException, UTFDataFormatException, IOException;    String readUTF() throws EOFException, UTFDataFormatException, IOException;
402    
# Line 398  public interface DataInput Line 404  public interface DataInput
404     * This method reads raw bytes into the passed array until the array is     * This method reads raw bytes into the passed array until the array is
405     * full.  Note that this method blocks until the data is available and     * full.  Note that this method blocks until the data is available and
406     * throws an exception if there is not enough data left in the stream to     * throws an exception if there is not enough data left in the stream to
407     * fill the buffer     * fill the buffer.  Note also that zero length buffers are permitted.
408       * In this case, the method will return immediately without reading any
409       * bytes from the stream.
410     *     *
411     * @param buf The buffer into which to read the data     * @param buf The buffer into which to read the data
412     *     *
# Line 414  public interface DataInput Line 422  public interface DataInput
422     * <code>offset</code> bytes into the buffer.  The number of bytes read     * <code>offset</code> bytes into the buffer.  The number of bytes read
423     * will be     * will be
424     * exactly <code>len</code>.  Note that this method blocks until the data is     * exactly <code>len</code>.  Note that this method blocks until the data is
425     * available and * throws an exception if there is not enough data left in     * available and throws an exception if there is not enough data left in
426     * the stream to read <code>len</code> bytes.     * the stream to read <code>len</code> bytes.  Note also that zero length
427       * buffers are permitted.  In this case, the method will return immediately
428       * without reading any bytes from the stream.
429     *     *
430     * @param buf The buffer into which to read the data     * @param buf The buffer into which to read the data
431     * @param offset The offset into the buffer to start storing data     * @param offset The offset into the buffer to start storing data
# Line 430  public interface DataInput Line 440  public interface DataInput
440    
441    /**    /**
442     * This method skips and discards the specified number of bytes in an     * This method skips and discards the specified number of bytes in an
443     * input stream     * input stream.  Note that this method may skip less than the requested
444       * number of bytes.  The actual number of bytes skipped is returned.
445     *     *
446     * @param num_bytes The number of bytes to skip     * @param numBytes The number of bytes to skip
447     *     *
448     * @return The number of bytes actually skipped, which will always be     * @return The number of bytes actually skipped, which will always be
449     *         <code>num_bytes</code>     *         <code>numBytes</code>
450     *     *
451     * @exception EOFException If end of file is reached before all bytes can be     * @exception EOFException If end of file is reached before all bytes can be
452     *                         skipped     *                         skipped
453     * @exception IOException If any other error occurs     * @exception IOException If any other error occurs
454     */     */
455    int skipBytes(int n) throws EOFException, IOException;    int skipBytes(int numBytes) throws EOFException, IOException;
456    
457  } // interface DataInput  } // interface DataInput

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26