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 DataAccessMMA

    java.lang.Object
      org.basex.io.DataAccessMMA

    public final class DataAccessMMA

extends java.lang.Object

This class allows positional read and write access to a database file.

Author:
  Workgroup DBIS, University of Konstanz 2005-09, ISC License, Christian Gruen

Constructor Summary
`DataAccessMMA(java.io.File f)` Constructor, initializing the file reader.
`DataAccessMMA(java.lang.String f)` Constructor, initializing the file reader.
`DataAccessMMA(java.lang.String db, java.lang.String fn)` Constructor, initializing the file reader.

Method Summary
`void` | `close()` Closes the data access.
`void` | `cursor(long p)` Sets the disk cursor.
`long` | `length()` Returns file length.
`boolean` | `more()` Checks if more bytes can be read.
`long` | `pos()` Returns the current file position.
`int` | `read()` Reads the next byte.
`long` | `read5(long p)` Reads an 5-byte value from the specified file offset.
`byte` | `readByte()` Reads a byte value.
`byte` | `readByte(long p)` Reads a byte value from the specified position.
`byte[]` | `readBytes(long from, long to)` Reads a number of bytes in range from -> to and returns them as array.
`int` | `readInt()` Reads an integer value from the specified position (without cursor correction).
`int` | `readInt(long p)` Reads an integer value from the specified position.
`int` | `readNum()` Reads the next compressed number and returns it as integer.
`int` | `readNum(long p)` Reads a `Num` value from disk.
`byte[]` | `readToken(long p)` Reads a token from disk.
`void` | `writeBytes(long p, byte[] v)` Append a value to the file and return it's offset.

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

Constructor Detail

### DataAccessMMA

    public DataAccessMMA(java.lang.String db,
                         java.lang.String fn)
                  throws java.io.IOException

  Constructor, initializing the file reader.

  Parameters:
    `db` - name of the database
    `fn` - the file to be read
  Throws:
    `java.io.IOException` - IO Exception

### DataAccessMMA

    public DataAccessMMA(java.lang.String f)
                  throws java.io.IOException

  Constructor, initializing the file reader.

  Parameters:
    `f` - the file to be read
  Throws:
    `java.io.IOException` - IO Exception

### DataAccessMMA

    public DataAccessMMA(java.io.File f)
                  throws java.io.IOException

  Constructor, initializing the file reader.

  Parameters:
    `f` - the file to be read
  Throws:
    `java.io.IOException` - IO Exception

Method Detail

### close

    public void close()
               throws java.io.IOException

  Closes the data access.

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

### length

    public long length()

  Returns file length.

  Returns:
    file length

### read5

    public long read5(long p)

  Reads an 5-byte value from the specified file offset.

  Parameters:
    `p` - position
  Returns:
    long value

### readNum

    public int readNum(long p)

  Reads a `Num` value from disk.

  Parameters:
    `p` - text position
  Returns:
    read num

### readToken

    public byte[] readToken(long p)

  Reads a token from disk.

  Parameters:
    `p` - text position
  Returns:
    text as byte array

### pos

    public long pos()

  Returns the current file position.

  Returns:
    text as byte array

### readInt

    public int readInt(long p)

  Reads an integer value from the specified position.

  Parameters:
    `p` - position
  Returns:
    integer value

### readByte

    public byte readByte(long p)

  Reads a byte value from the specified position.

  Parameters:
    `p` - position
  Returns:
    integer value

### readByte

    public byte readByte()

  Reads a byte value.

  Returns:
    integer value

### readBytes

    public byte[] readBytes(long from,
                            long to)

  Reads a number of bytes in range from -> to and returns them as array.

  Parameters:
    `from` - starting position for reading
    `to` - ending position for reading
  Returns:
    byte array

### writeBytes

    public void writeBytes(long p,
                           byte[] v)

  Append a value to the file and return it's offset.

  Parameters:
    `p` - write position
    `v` - byte array to be appended

### cursor

    public void cursor(long p)

  Sets the disk cursor.

  Parameters:
    `p` - read position

### read

    public int read()

  Reads the next byte.

  Returns:
    next byte

### more

    public boolean more()

  Checks if more bytes can be read.

  Returns:
    result of check

### readNum

    public int readNum()

  Reads the next compressed number and returns it as integer.

  Returns:
    next integer

### readInt

    public int readInt()

  Reads an integer value from the specified position (without cursor correction).

  Returns:
    integer value

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