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.crosswire.jsword.book.sword
Class DataEntry

    java.lang.Object
      org.crosswire.jsword.book.sword.DataEntry

    public class DataEntry

extends Object

Data entry represents an entry in a Data file. The entry consists of a key and an optional payload. The payload may be the content, aka rawtext. The payload may be an alias for another entry. The payload may be a block locator.

Author:
  DM Smith [dmsmith555 at yahoo dot com]
See Also:
  `for license details.
  The copyright to this program is held by it's authors.`

Field Summary
`private String` | `charset` The character set of the data entry.
`private byte[]` | `data` The data entry as it comes out of the data file.
`private String` | `key` The key in the data entry.
`private int` | `keyEnd` The index of the separator between the key and the rest of the stuff.
`private int` | `linkEnd` The index of the separator between the link and the rest of the stuff.
`private String` | `name` A diagnostic name.
`private static byte` | `SEPARATOR` Used to separate the key name from the key value Note: it may be \r\n or just \n, so only need \n.

Constructor Summary
`DataEntry(String name, byte[] data, String charset)` Construct a data entry.

Method Summary
`void` | `cipher(byte[] cipherKey, int offset)` Decipher/Encipher the data in place, if there is a cipher key.
`DataIndex` | `getBlockIndex()` Get the block start and entry position.
`String` | `getKey()` Get the key from this DataEntry.
`private int` | `getKeyEnd()` Get the position of the first \n in the data.
`private int` | `getLinkEnd()` Get the position of the second \n in the data.
`String` | `getLinkTarget()` Get the link target for this entry.
`String` | `getName()` Get the name, that is, the diagnostic label, for this DataEntry.
`String` | `getRawText(byte[] cipherKey)` Get the raw text from this entry.
`boolean` | `isLinkEntry()` Determine whether this entry is an alias for another.

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

Field Detail

### SEPARATOR

    private static final byte SEPARATOR

  Used to separate the key name from the key value Note: it may be \r\n or just \n, so only need \n. ^M=CR=13=0x0d=\r ^J=LF=10=0x0a=\n

  See Also:
    Constant Field Values

### name

    private String name

  A diagnostic name.

### data

    private byte[] data

  The data entry as it comes out of the data file.

### charset

    private String charset

  The character set of the data entry.

### key

    private String key

  The key in the data entry.

### keyEnd

    private int keyEnd

  The index of the separator between the key and the rest of the stuff.

### linkEnd

    private int linkEnd

  The index of the separator between the link and the rest of the stuff.

Constructor Detail

### DataEntry

    public DataEntry(String name,
                     byte[] data,
                     String charset)

  Construct a data entry.

  Parameters:
    `name` - A name used for diagnostics.
    `data` - The data for this entry.
    `charset` - The character encoding for this entry.

Method Detail

### getName

    public String getName()

  Get the name, that is, the diagnostic label, for this DataEntry.

  Returns:
    the diagnostic name.

### getKey

    public String getKey()

  Get the key from this DataEntry.

  Returns:
    the key

### isLinkEntry

    public boolean isLinkEntry()

  Determine whether this entry is an alias for another.

  Returns:
    whether this is an alias entry

### getLinkTarget

    public String getLinkTarget()

  Get the link target for this entry. One entry can be chained to another. If the entry is not linked then it is an error to call this method.

  Returns:
    the key to look up
  See Also:
    `isLinkEntry()`

### getRawText

    public String getRawText(byte[] cipherKey)

  Get the raw text from this entry.

  Parameters:
    `cipherKey` - the key, if any, to (un)lock the text
  Returns:
    the raw text

### getBlockIndex

    public DataIndex getBlockIndex()

  Get the block start and entry position.

  Returns:
    the index of the block

### getKeyEnd

    private int getKeyEnd()

  Get the position of the first \n in the data. This represents the end of the key and the start of the rest of the data.

  Returns:
    the end of the key or -1 if not found.

### getLinkEnd

    private int getLinkEnd()

  Get the position of the second \n in the data. This represents the end of the link and the start of the rest of the data.

  Returns:
    the end of the link or -1 if not found.

### cipher

    public void cipher(byte[] cipherKey,
                       int offset)

  Decipher/Encipher the data in place, if there is a cipher key.

  Parameters:
    `cipherKey` - the key to the cipher

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