Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.basex.io
Class DataOutput

    java.lang.Object
      java.io.OutputStream
          org.basex.io.DataOutput

All Implemented Interfaces:
  Closeable, Flushable

    public final class DataOutput

extends OutputStream

This is an output stream for project specific data types.

Author:
  Workgroup DBIS, University of Konstanz 2005-10, ISC License, Christian Gruen, Tim Petrowsky

Constructor Summary
`DataOutput(File db)` Convenience constructor.
`DataOutput(File db, int bufs)` Convenience constructor with a specified buffer size.
`DataOutput(OutputStream out)` Constructor writing to an output stream.

Method Summary
`void` | `close()`
`void` | `flush()`
`long` | `size()` Returns the number of written bytes.
`void` | `write(int b)`
`void` | `write1(int v)` Writes an integer value to the specified output stream.
`void` | `write2(int v)` Writes an integer value to the specified output stream.
`void` | `write5(long v)` Writes an integer value to the specified output stream.
`void` | `writeBool(boolean b)` Writes a boolean value to the output stream.
`int` | `writeBytes(byte[] text)` Writes the specified array to the output stream.
`void` | `writeBytesArray(byte[][] array)` Writes the specified array to the output stream; null references are replaced with an empty array.
`int` | `writeDouble(double num)` Writes the specified array to the output stream.
`void` | `writeInt(int v)` Writes an integer value to the specified output stream.
`int` | `writeNum(int v)` Compresses and writes an integer value to the specified output stream.
`void` | `writeNums(int[] array)` Writes the specified array to the output stream.
`void` | `writeString(String s)` Writes a string to the output stream.

Methods inherited from class java.io.OutputStream
`write, write`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DataOutput

    public DataOutput(OutputStream out)

  Constructor writing to an output stream. Writes to the stream will not be buffered.

  Parameters:
    `out` - Output Stream to operate on

### DataOutput

    public DataOutput(File db)
               throws IOException

  Convenience constructor. A default buffer size will be used.

  Parameters:
    `db` - name of the database
  Throws:
    `IOException` - I/O exception

### DataOutput

    public DataOutput(File db,
                      int bufs)
               throws IOException

  Convenience constructor with a specified buffer size. The specified buffer size is used.

  Parameters:
    `db` - name of the database
    `bufs` - size of the buffer to use
  Throws:
    `IOException` - I/O exception

Method Detail

### write

    public void write(int b)
               throws IOException

  Specified by:
    `write` in class `OutputStream`
  Throws:
    `IOException`

### writeBool

    public void writeBool(boolean b)
                   throws IOException

  Writes a boolean value to the output stream.

  Parameters:
    `b` - boolean value
  Throws:
    `IOException` - I/O exception

### writeString

    public void writeString(String s)
                     throws IOException

  Writes a string to the output stream.

  Parameters:
    `s` - string
  Throws:
    `IOException` - I/O exception

### writeBytes

    public int writeBytes(byte[] text)
                   throws IOException

  Writes the specified array to the output stream.

  Parameters:
    `text` - array to be written
  Returns:
    number of written bytes
  Throws:
    `IOException` - I/O exception

### writeDouble

    public int writeDouble(double num)
                    throws IOException

  Writes the specified array to the output stream.

  Parameters:
    `num` - array to be written
  Returns:
    number of written bytes
  Throws:
    `IOException` - I/O exception

### writeBytesArray

    public void writeBytesArray(byte[][] array)
                         throws IOException

  Writes the specified array to the output stream; null references are replaced with an empty array.

  Parameters:
    `array` - array to be written
  Throws:
    `IOException` - I/O exception

### writeNums

    public void writeNums(int[] array)
                   throws IOException

  Writes the specified array to the output stream.

  Parameters:
    `array` - array to be written
  Throws:
    `IOException` - I/O exception

### writeNum

    public int writeNum(int v)
                 throws IOException

  Compresses and writes an integer value to the specified output stream. By compressing, the size of the database files is reduced.

  Parameters:
    `v` - value to be written
  Returns:
    number of written values
  Throws:
    `IOException` - I/O exception

### writeInt

    public void writeInt(int v)
                  throws IOException

  Writes an integer value to the specified output stream.

  Parameters:
    `v` - value to be written
  Throws:
    `IOException` - I/O exception

### write1

    public void write1(int v)
                throws IOException

  Writes an integer value to the specified output stream.

  Parameters:
    `v` - value to be written
  Throws:
    `IOException` - I/O exception

### write2

    public void write2(int v)
                throws IOException

  Writes an integer value to the specified output stream.

  Parameters:
    `v` - value to be written
  Throws:
    `IOException` - I/O exception

### write5

    public void write5(long v)
                throws IOException

  Writes an integer value to the specified output stream.

  Parameters:
    `v` - value to be written
  Throws:
    `IOException` - I/O exception

### size

    public long size()

  Returns the number of written bytes. This is not necessarily e.g. the file size.

  Returns:
    number of written bytes

### flush

    public void flush()
               throws IOException

  Specified by:
    `flush` in interface `Flushable`
  Overrides:
    `flush` in class `OutputStream`
  Throws:
    `IOException`

### close

    public void close()
               throws IOException

  Specified by:
    `close` in interface `Closeable`
  Overrides:
    `close` in class `OutputStream`
  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD