## xbase
Class EncryptFile

    java.lang.Object
      |
      +--java.io.RandomAccessFile
            |
            +--xbase.EncryptFile

public class EncryptFile
extends java.io.RandomAccessFile

A file supporting encryption.

See Also:
  `RandomAccessFile`

Constructor Summary
`EncryptFile(java.lang.String name, java.lang.String mode)` Constructor.

Method Summary
`int` `read()` Read one byte.
`int` `read(byte[] buf)` Read an array of bytes.
`int` `read(byte[] buf, int off, int len)` Read an array of bytes.
`int` `readBackwardsInt()` Reads a swapped int.
`short` `readBackwardsShort()` Read a swapped short.
`int` `readBackwardsUnsignedShort()` Reads unsigned short.
`int` `readForwardsInt()` Reads an int.
`short` `readForwardsShort()`
`java.lang.String` `readMemoBlock()` Read a memo block, which is a String terminted by null, -1, or 26
`void` `setKey(int[] key)` Set the key used for this encrypted file.

Methods inherited from class java.io.RandomAccessFile
`close, getFD, getFilePointer, length, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, seek, setLength, skipBytes, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF`

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

Constructor Detail

### EncryptFile

    public EncryptFile(java.lang.String name,
                       java.lang.String mode)
                throws java.io.IOException

  Constructor.
  Parameters:
    `name` - The file name.
    `mode` - The access mode.
  See Also:
    `RandomAccessFile.RandomAccessFile(java.io.File, java.lang.String)`

Method Detail

### setKey

    public void setKey(int[] key)

  Set the key used for this encrypted file. Expected to be 128 bits (4 ints)
  Parameters:
    `key` - The key to use.

### read

    public int read()
             throws java.io.IOException

  Read one byte.
  Overrides:
    read in class java.io.RandomAccessFile

### read

    public int read(byte[] buf,
                    int off,
                    int len)
             throws java.io.IOException

  Read an array of bytes.
  Overrides:
    read in class java.io.RandomAccessFile
  Parameters:
    `buf` - The buffer to read into.
    `off` - The offset into the buffer to use.
    `len` - The number of bytes to read.
  Returns:
    The number of bytes available.

### read

    public int read(byte[] buf)
             throws java.io.IOException

  Read an array of bytes.
  Overrides:
    read in class java.io.RandomAccessFile
  Parameters:
    `buf` - The buffer to read into.
  Returns:
    The number of bytes available.

### readBackwardsShort

    public short readBackwardsShort()
                             throws java.io.IOException

  Read a swapped short.

### readForwardsShort

    public short readForwardsShort()
                            throws java.io.IOException

### readBackwardsUnsignedShort

    public int readBackwardsUnsignedShort()
                                   throws java.io.IOException

  Reads unsigned short.

### readBackwardsInt

    public int readBackwardsInt()
                         throws java.io.IOException

  Reads a swapped int.

### readForwardsInt

    public int readForwardsInt()
                        throws java.io.IOException

  Reads an int.

### readMemoBlock

    public java.lang.String readMemoBlock()
                                   throws java.io.IOException

  Read a memo block, which is a String terminted by null, -1, or 26