Qizx/Open v0.4

net.xfra.qizxopen.util
Class OutputByteStream

java.lang.Object
  |
  +--net.xfra.qizxopen.util.OutputByteStream

public class OutputByteStream
extends java.lang.Object

An efficient BufferedOutputStream with support for more data types.


Constructor Summary
OutputByteStream(java.io.File file)
           
OutputByteStream(java.io.OutputStream out)
           
 
Method Summary
 void close()
           
static int encodeInt(int code, byte[] buffer, int bufSize)
          Stores a positive int in variable-length encoding.
static int encodeLong(long code, byte[] buffer, int bufSize)
           
 void flush()
           
 void putByte(int b)
           
 void putBytes(byte[] buf)
           
 void putBytes(byte[] buf, int start, int bsize)
           
 void putChars(char[] chars)
           
 void putDouble(double value)
           
 void putString(java.lang.String s)
           
 void putVint(int code)
           
 void putVlong(long code)
           
 void syncClose()
          Closes and synchronizes the file on disk.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutputByteStream

public OutputByteStream(java.io.File file)
                 throws java.io.FileNotFoundException

OutputByteStream

public OutputByteStream(java.io.OutputStream out)
Method Detail

putByte

public void putByte(int b)
             throws java.io.IOException
java.io.IOException

putBytes

public void putBytes(byte[] buf)
              throws java.io.IOException
java.io.IOException

putBytes

public void putBytes(byte[] buf,
                     int start,
                     int bsize)
              throws java.io.IOException
java.io.IOException

flush

public void flush()
           throws java.io.IOException
java.io.IOException

close

public void close()
           throws java.io.IOException
java.io.IOException

syncClose

public void syncClose()
               throws java.io.IOException
Closes and synchronizes the file on disk. CAUTION: assumes the underlying OutputStream is a FileOutputStream.

java.io.IOException

putVint

public void putVint(int code)
             throws java.io.IOException
java.io.IOException

putVlong

public void putVlong(long code)
              throws java.io.IOException
java.io.IOException

putDouble

public void putDouble(double value)
               throws java.io.IOException
java.io.IOException

putString

public void putString(java.lang.String s)
               throws java.io.IOException
java.io.IOException

putChars

public void putChars(char[] chars)
              throws java.io.IOException
java.io.IOException

encodeInt

public static int encodeInt(int code,
                            byte[] buffer,
                            int bufSize)
Stores a positive int in variable-length encoding. Assumes that the buffer is large enough.

Returns:
the new buffer size.

encodeLong

public static int encodeLong(long code,
                             byte[] buffer,
                             int bufSize)

 Copyright Xavier FRANC 2003-2004