home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / main.bin / DataInput.java < prev    next >
Text File  |  1997-05-20  |  8KB  |  209 lines

  1. /*
  2.  * @(#)DataInput.java    1.8 97/01/22
  3.  * 
  4.  * Copyright (c) 1995, 1996 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion 1.1_beta
  20.  * 
  21.  */
  22.  
  23. package java.io;
  24.  
  25. /**
  26.  * The data input interface is implemented by streams that can read 
  27.  * primitive Java data types from a stream in a machine-independent 
  28.  * manner. 
  29.  *
  30.  * @author  Frank Yellin
  31.  * @version 1.8, 01/22/97
  32.  * @see     java.io.DataInputStream 
  33.  * @see     java.io.DataOutput  
  34.  * @since   JDK1.0
  35.  */
  36. public
  37. interface DataInput {
  38.     /**
  39.      * Reads <code>b.length</code> bytes into the byte array. This 
  40.      * method blocks until all the bytes are read. 
  41.      *
  42.      * @param     b   the buffer into which the data is read.
  43.      * @exception  EOFException  if this stream reaches the end before reading
  44.      *               all the bytes.
  45.      * @exception  IOException   if an I/O error occurs.
  46.      * @since      JDK1.0
  47.      */
  48.     void readFully(byte b[]) throws IOException;
  49.  
  50.     /**
  51.      * Reads <code>b.length</code> bytes into the byte array. This 
  52.      * method blocks until all the bytes are read. 
  53.      *
  54.      * @param     b   the buffer into which the data is read.
  55.      * @exception  EOFException  if this stream reaches the end before reading
  56.      *               all the bytes.
  57.      * @exception  IOException   if an I/O error occurs.
  58.      * @since   JDK1.0
  59.      */
  60.     void readFully(byte b[], int off, int len) throws IOException;
  61.  
  62.     /**
  63.      * Skips exactly <code>n</code> bytes of input. 
  64.      *
  65.      * @param      n   the number of bytes to be skipped.
  66.      * @return     the number of bytes skipped, which is always <code>n</code>.
  67.      * @exception  EOFException  if this stream reaches the end before skipping
  68.      *               all the bytes.
  69.      * @exception  IOException   if an I/O error occurs.
  70.      * @since      JDK1.0
  71.      */
  72.     int skipBytes(int n) throws IOException;
  73.  
  74.     /**
  75.      * Reads a <code>boolean</code> value from the input stream. 
  76.      *
  77.      * @return     the <code>boolean</code> value read.
  78.      * @exception  EOFException  if this stream reaches the end before reading
  79.      *               all the bytes.
  80.      * @exception  IOException   if an I/O error occurs.
  81.      * @since      JDK1.0
  82.      */
  83.     boolean readBoolean() throws IOException;
  84.  
  85.     /**
  86.      * Reads a signed 8-bit value from the input stream. 
  87.      *
  88.      * @return     the 8-bit value read.
  89.      * @exception  EOFException  if this stream reaches the end before reading
  90.      *               all the bytes.
  91.      * @exception  IOException   if an I/O error occurs.
  92.      * @since      JDK1.0
  93.      */
  94.     byte readByte() throws IOException;
  95.  
  96.     /**
  97.      * Reads an unsigned 8-bit value from the input stream. 
  98.      *
  99.      * @return     the unsigned 8-bit value read.
  100.      * @exception  EOFException  if this stream reaches the end before reading
  101.      *               all the bytes.
  102.      * @exception  IOException   if an I/O error occurs.
  103.      * @since      JDK1.0
  104.      */
  105.     int readUnsignedByte() throws IOException;
  106.  
  107.     /**
  108.      * Reads a 16-bit value from the input stream. 
  109.      *
  110.      * @return     the 16-bit value read.
  111.      * @exception  EOFException  if this stream reaches the end before reading
  112.      *               all the bytes.
  113.      * @exception  IOException   if an I/O error occurs.
  114.      * @since      JDK1.0
  115.      */
  116.     short readShort() throws IOException;
  117.  
  118.     /**
  119.      * Reads an unsigned 16-bit value from the input stream. 
  120.      *
  121.      * @return     the unsigned 16-bit value read.
  122.      * @exception  EOFException  if this stream reaches the end before reading
  123.      *               all the bytes.
  124.      * @exception  IOException   if an I/O error occurs.
  125.      * @since      JDK1.0
  126.      */
  127.     int readUnsignedShort() throws IOException;
  128.  
  129.     /**
  130.      * Reads a Unicode <code>char</code> value from the input stream. 
  131.      *
  132.      * @return     the Unicode <code>char</code> read.
  133.      * @exception  EOFException  if this stream reaches the end before reading
  134.      *               all the bytes.
  135.      * @exception  IOException   if an I/O error occurs.
  136.      * @since      JDK1.0
  137.      */
  138.     char readChar() throws IOException;
  139.  
  140.     /**
  141.      * Reads an <code>int</code> value from the input stream. 
  142.      *
  143.      * @return     the <code>int</code> value read.
  144.      * @exception  EOFException  if this stream reaches the end before reading
  145.      *               all the bytes.
  146.      * @exception  IOException   if an I/O error occurs.
  147.      * @since      JDK1.0
  148.      */
  149.     int readInt() throws IOException;
  150.  
  151.     /**
  152.      * Reads a <code>long</code> value from the input stream. 
  153.      *
  154.      * @return     the <code>long</code> value read.
  155.      * @exception  EOFException  if this stream reaches the end before reading
  156.      *               all the bytes.
  157.      * @exception  IOException   if an I/O error occurs.
  158.      * @since      JDK1.0
  159.      */
  160.     long readLong() throws IOException;
  161.  
  162.     /**
  163.      * Reads a <code>float</code> value from the input stream. 
  164.      *
  165.      * @return     the <code>float</code> value read.
  166.      * @exception  EOFException  if this stream reaches the end before reading
  167.      *               all the bytes.
  168.      * @exception  IOException   if an I/O error occurs.
  169.      * @since      JDK1.0
  170.      */
  171.     float readFloat() throws IOException;
  172.  
  173.     /**
  174.      * Reads a <code>double</code> value from the input stream. 
  175.      *
  176.      * @return     the <code>double</code> value read.
  177.      * @exception  EOFException  if this stream reaches the end before reading
  178.      *               all the bytes.
  179.      * @exception  IOException   if an I/O error occurs.
  180.      * @since      JDK1.0
  181.      */
  182.     double readDouble() throws IOException;
  183.  
  184.     /**
  185.      * Reads the next line of text from the input stream. 
  186.      *
  187.      * @return     if this stream reaches the end before reading all the bytes.
  188.      * @exception  IOException  if an I/O error occurs.
  189.      * @since      JDK1.0
  190.      */
  191.     String readLine() throws IOException;
  192.  
  193.     /**
  194.      * Reads in a string that has been encoded using a modified UTF-8 format.
  195.      * <p>
  196.      * For an exact description of this method, see the discussion in 
  197.      * Gosling, Joy, and Steele, <i>The Java Language Specification</i>. 
  198.      *
  199.      * @return     a Unicode string.
  200.      * @exception  EOFException            if this stream reaches the end
  201.      *               before reading all the bytes.
  202.      * @exception  IOException             if an I/O error occurs.
  203.      * @exception  UTFDataFormatException  if the bytes do not represent a
  204.      *               valid UTF-8 encoding of a string.
  205.      * @since      JDK1.0
  206.      */
  207.     String readUTF() throws IOException;
  208. }
  209.