it.unimi.dsi.fastutil.io
Class FastBufferedOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by it.unimi.dsi.fastutil.io.FastBufferedOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class FastBufferedOutputStream
extends java.io.OutputStream

Lightweight, unsynchronized output stream buffering class.

This class provides buffering for output streams, but all methods are unsynchronised.

Since:
4.4

Field Summary
static int DEFAULT_BUFFER_SIZE
          The default size of the internal buffer in bytes (8Ki).
 
Constructor Summary
FastBufferedOutputStream(java.io.OutputStream os)
          Creates a new fast buffered ouptut stream by wrapping a given output stream with a buffer of DEFAULT_BUFFER_SIZE bytes.
FastBufferedOutputStream(java.io.OutputStream os, int bufferSize)
          Creates a new fast buffered output stream by wrapping a given output stream with a given buffer size.
 
Method Summary
 void close()
           
 void flush()
           
 void write(byte[] b, int offset, int length)
           
 void write(int b)
           
 
Methods inherited from class java.io.OutputStream
write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BUFFER_SIZE

public static final int DEFAULT_BUFFER_SIZE
The default size of the internal buffer in bytes (8Ki).

See Also:
Constant Field Values
Constructor Detail

FastBufferedOutputStream

public FastBufferedOutputStream(java.io.OutputStream os,
                                int bufferSize)
Creates a new fast buffered output stream by wrapping a given output stream with a given buffer size.

Parameters:
os - an output stream to wrap.
bufferSize - the size in bytes of the internal buffer.

FastBufferedOutputStream

public FastBufferedOutputStream(java.io.OutputStream os)
Creates a new fast buffered ouptut stream by wrapping a given output stream with a buffer of DEFAULT_BUFFER_SIZE bytes.

Parameters:
os - an output stream to wrap.
Method Detail

write

public void write(int b)
           throws java.io.IOException
Specified by:
write in class java.io.OutputStream
Throws:
java.io.IOException

write

public void write(byte[] b,
                  int offset,
                  int length)
           throws java.io.IOException
Overrides:
write in class java.io.OutputStream
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException