Overview | Package | Class | Use | Tree | 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:
  java.io.Closeable, java.io.Flushable

    public final class DataOutput

extends java.io.OutputStream

This is an output stream for project specific data types.

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

Constructor Summary
`DataOutput(java.io.OutputStream out)` Constructor writing to an output stream.
`DataOutput(java.lang.String db, java.lang.String fn)` Convenience constructor.
`DataOutput(java.lang.String db, java.lang.String fn, int bufs)` Convenience constructor with underlying.

Method Summary
`void` | `close()`
`void` | `flush()`
`int` | `size()` Return 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.
`void` | `writeBooleans(boolean[] array)` Writes the specified array to the output stream.
`void` | `writeBytes(byte[] array)` 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.
`void` | `writeBytesArrayFlat(byte[][] array)` Writes the specified array to the output stream; null references are replaced with an empty array.
`void` | `writeBytesFlat(byte[] array)` Writes the specified array to the output stream.
`void` | `writeInt(int v)` Writes an integer value to the specified output stream.
`void` | `writeIntArray(int[][] array)` Writes the specified array to the output stream; null references are replaced with an empty array.
`void` | `writeInts(int[] array)` Writes the specified array to the 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` | `writeNumsArray(int[][] array)` Writes the specified array to the output stream; null references are replaced with an empty array.
`void` | `writeString(java.lang.String s)` Writes a string to the output stream.
`void` | `writeStructureWithOffsets(int[] array)` Writes the specifies array to output stream as follows.
`int` | `writeToken(byte[] text)` Finishes the file.

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(java.io.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(java.lang.String db,
                      java.lang.String fn)
               throws java.io.IOException

  Convenience constructor. A default buffersize will be used. DBSUFFIX will be added to the filename.

  Parameters:
    `db` - name of the database
    `fn` - File to write to
  Throws:
    `java.io.IOException` - in case of write errors

### DataOutput

    public DataOutput(java.lang.String db,
                      java.lang.String fn,
                      int bufs)
               throws java.io.IOException

  Convenience constructor with underlying. The specified buffersize is used. DBSUFFIX will be added to the filename.

  Parameters:
    `db` - name of the database
    `fn` - name of the file to write to
    `bufs` - size of the buffer to use
  Throws:
    `java.io.IOException` - in case of write errors

Method Detail

### 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`

### 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`

### size

    public int size()

  Return the number of written bytes. This is not necessary e.g. the file size.

  Returns:
    number of written bytes

### write

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

  Specified by:
    `write` in class `java.io.OutputStream`
  Throws:
    `java.io.IOException`

### write1

    public void write1(int v)
                throws java.io.IOException

  Writes an integer value to the specified output stream.

  Parameters:
    `v` - value to be written
  Throws:
    `java.io.IOException` - in case of write errors

### write2

    public void write2(int v)
                throws java.io.IOException

  Writes an integer value to the specified output stream.

  Parameters:
    `v` - value to be written
  Throws:
    `java.io.IOException` - in case of write errors

### write5

    public void write5(long v)
                throws java.io.IOException

  Writes an integer value to the specified output stream.

  Parameters:
    `v` - value to be written
  Throws:
    `java.io.IOException` - in case of write errors

### writeBool

    public void writeBool(boolean b)
                   throws java.io.IOException

  Writes a boolean value to the output stream.

  Parameters:
    `b` - boolean value
  Throws:
    `java.io.IOException` - in case of write errors

### writeBooleans

    public void writeBooleans(boolean[] array)
                       throws java.io.IOException

  Writes the specified array to the output stream.

  Parameters:
    `array` - array to be written
  Throws:
    `java.io.IOException` - in case of write errors

### writeBytes

    public void writeBytes(byte[] array)
                    throws java.io.IOException

  Writes the specified array to the output stream.

  Parameters:
    `array` - array to be written
  Throws:
    `java.io.IOException` - in case of write errors

### writeBytesArray

    public void writeBytesArray(byte[][] array)
                         throws java.io.IOException

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

  Parameters:
    `array` - array to be written
  Throws:
    `java.io.IOException` - in case of write errors

### writeBytesArrayFlat

    public void writeBytesArrayFlat(byte[][] array)
                             throws java.io.IOException

  Writes the specified array to the output stream; null references are replaced with an empty array. No size info is written!!

  Parameters:
    `array` - array to be written
  Throws:
    `java.io.IOException` - in case of write errors

### writeBytesFlat

    public void writeBytesFlat(byte[] array)
                        throws java.io.IOException

  Writes the specified array to the output stream. No size info is written!!

  Parameters:
    `array` - array to be written
  Throws:
    `java.io.IOException` - in case of write errors

### writeInt

    public void writeInt(int v)
                  throws java.io.IOException

  Writes an integer value to the specified output stream.

  Parameters:
    `v` - value to be written
  Throws:
    `java.io.IOException` - in case of write errors

### writeIntArray

    public void writeIntArray(int[][] array)
                       throws java.io.IOException

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

  Parameters:
    `array` - array to be written
  Throws:
    `java.io.IOException` - in case of write errors

### writeInts

    public void writeInts(int[] array)
                   throws java.io.IOException

  Writes the specified array to the output stream.

  Parameters:
    `array` - array to be written
  Throws:
    `java.io.IOException` - in case of write errors

### writeNum

    public int writeNum(int v)
                 throws java.io.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:
    `java.io.IOException` - in case of write errors

### writeNums

    public void writeNums(int[] array)
                   throws java.io.IOException

  Writes the specified array to the output stream.

  Parameters:
    `array` - array to be written
  Throws:
    `java.io.IOException` - in case of write errors

### writeNumsArray

    public void writeNumsArray(int[][] array)
                        throws java.io.IOException

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

  Parameters:
    `array` - array to be written
  Throws:
    `java.io.IOException` - in case of write errors

### writeString

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

  Writes a string to the output stream.

  Parameters:
    `s` - string
  Throws:
    `java.io.IOException` - in case of write errors

### writeStructureWithOffsets

    public void writeStructureWithOffsets(int[] array)
                                   throws java.io.IOException

  Writes the specifies array to output stream as follows. Input: {a, b, c, d, e, ...} Written: {a, a+b, a+b+c, a+b+c+d, a+b+c+d+e, ...}

  Parameters:
    `array` - inputarray
  Throws:
    `java.io.IOException` - in case of wrtie errors

### writeToken

    public int writeToken(byte[] text)
                   throws java.io.IOException

  Finishes the file.

  Parameters:
    `text` - text to be written
  Returns:
    length of written bytes
  Throws:
    `java.io.IOException` - in case of write errors

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