home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / java.z / DataOutput.java < prev    next >
Text File  |  1996-05-03  |  3KB  |  125 lines

  1. /*
  2.  * @(#)DataOutput.java    1.4 95/12/18 Frank Yellin
  3.  *
  4.  * Copyright (c) 1995 Sun Microsystems, Inc. All Rights Reserved.
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software
  7.  * and its documentation for NON-COMMERCIAL purposes and without
  8.  * fee is hereby granted provided that this copyright notice
  9.  * appears in all copies. Please refer to the file "copyright.html"
  10.  * for further important copyright and licensing information.
  11.  *
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
  13.  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  14.  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  15.  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
  16.  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  17.  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  18.  */
  19.  
  20. package java.io;
  21.  
  22. /**
  23.  * DataOutput is an interface describing streams that can write 
  24.  * output in a machine-independent format.
  25.  *
  26.  * @see DataOutputStream
  27.  * @see DataInput
  28.  * @version     1.4, 18 Dec 1995
  29.  * @author    Frank Yellin
  30.  */
  31.  
  32. public
  33. interface DataOutput {
  34.     /**
  35.      * Writes a byte. Will block until the byte is actually
  36.      * written.
  37.      * @param b the byte to be written
  38.      * @exception IOException If an I/O error has occurred.
  39.      */
  40.     void write(int b) throws IOException;
  41.  
  42.     /**
  43.      * Writes an array of bytes.  
  44.      * @param b    the data to be written
  45.      * @exception IOException If an I/O error has occurred.
  46.      */
  47.     void write(byte b[]) throws IOException;
  48.  
  49.     /**
  50.      * Writes a subarray of bytes.  
  51.      * @param b    the data to be written
  52.      * @param off    the start offset in the data
  53.      * @param len    the number of bytes that are written
  54.      * @exception IOException If an I/O error has occurred.
  55.      */
  56.     void write(byte b[], int off, int len) throws IOException;
  57.  
  58.  
  59.     /**
  60.      * Writes a boolean.
  61.      * @param v the boolean to be written
  62.      */
  63.     void writeBoolean(boolean v) throws IOException;
  64.  
  65.     /**
  66.      * Writes an 8 bit byte.
  67.      * @param v the byte value to be written
  68.      */
  69.     void writeByte(int v) throws IOException;
  70.  
  71.     /**
  72.      * Writes a 16 bit short.
  73.      * @param v the short value to be written
  74.      */
  75.     void writeShort(int v) throws IOException;
  76.  
  77.     /**
  78.      * Writes a 16 bit char.
  79.      * @param v the char value to be written
  80.      */
  81.     void writeChar(int v) throws IOException;
  82.  
  83.     /**
  84.      * Writes a 32 bit int.
  85.      * @param v the integer value to be written
  86.      */
  87.     void writeInt(int v) throws IOException;
  88.  
  89.     /**
  90.      * Writes a 64 bit long.
  91.      * @param v the long value to be written
  92.      */
  93.     void writeLong(long v) throws IOException;
  94.  
  95.     /**
  96.      * Writes a 32 bit float.
  97.      * @param v the float value to be written
  98.      */
  99.     void writeFloat(float v) throws IOException;
  100.  
  101.     /**
  102.      * Writes a 64 bit double.
  103.      * @param v the double value to be written
  104.      */
  105.     void writeDouble(double v) throws IOException;
  106.  
  107.     /**
  108.      * Writes a String as a sequence of bytes.
  109.      * @param s the String of bytes to be written
  110.      */
  111.     void writeBytes(String s) throws IOException;
  112.  
  113.     /**
  114.      * Writes a String as a sequence of chars.
  115.      * @param s the String of chars to be written
  116.      */
  117.     void writeChars(String s) throws IOException;
  118.  
  119.     /**
  120.      * Writes a String in UTF format.
  121.      * @param str the String in UTF format
  122.      */
  123.     void writeUTF(String str) throws IOException;
  124. }
  125.