public class DataEntry extends Object
The payload may be:
The GNU Lesser General Public License for details.
Modifier and Type | Field and Description |
---|---|
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 payload.
|
private int |
linkEnd
The index of the separator between the link and the payload.
|
private String |
name
A diagnostic name.
|
private static byte |
SEP_BSLASH |
private static byte |
SEP_CR |
private static byte |
SEP_NL
Used to separate the key name from the key value Note: it may be \r\n or
just \n, so only need \n.
|
Constructor and Description |
---|
DataEntry(String name,
byte[] data,
String charset)
Construct a data entry.
|
Modifier and Type | Method and Description |
---|---|
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 |
getCharset()
Get the charset in which the data is encoded.
|
String |
getKey()
Get the key from this DataEntry.
|
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.
|
private static final byte SEP_NL
private static final byte SEP_CR
private static final byte SEP_BSLASH
private String name
private byte[] data
private String charset
private String key
private int keyEnd
private int linkEnd
public String getName()
public String getCharset()
public String getKey()
public boolean isLinkEntry()
public String getLinkTarget()
isLinkEntry()
public String getRawText(byte[] cipherKey)
cipherKey
- the key, if any, to (un)lock the textpublic DataIndex getBlockIndex()
private int getLinkEnd()
public void cipher(byte[] cipherKey, int offset)
cipherKey
- the key to the cipheroffset
- the start of the cipher data