SecureFileStore
| Modifier and Type | Field and Description |
|---|---|
| private static final boolean | |
| private Reference | |
| private boolean | |
| private FileChannel | |
| private long | |
| private long | |
| private final DataHandler | handler
The callback object is responsible to check access rights, and free up disk space if required. |
| private static final String | HEADER
The magic file header. |
| public static final int | HEADER_LENGTH
The size of the file header in bytes. |
| private FileLock | |
| private final String | |
| protected String | name
The file name. |
| Access | Constructor and Description |
|---|---|
| protected | FileStore(DataHandler
the callback object handler, String the file name name, String the access mode ("r", "rw", "rws", "rwd") mode)Create a new file using the given settings. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| private void | |
| private void | |
| public void | |
| public void | |
| public void | |
| private void | |
| public void | |
| protected byte[] | |
| public long | |
| public void | |
| protected void | |
| public long | |
| public static FileStore | Returns: the created objectthe data handler handler, String the file name name, String the access mode (r, rw, rws, rwd) mode)Open a non encrypted file store with the given settings. |
| public static FileStore | Returns: the created objectthe data handler handler, String the file name name, String the access mode (r, rw, rws, rwd) mode, String the name of the cipher algorithm cipher, byte[] the encryption key key)Open an encrypted file store with the given settings. |
| public static FileStore | Returns: the created objectthe data handler handler, String the file name name, String the access mode (r, rw, rws, rwd) mode, String the name of the cipher algorithm cipher, byte[] the encryption key key, int the number of iterations the key should be hashed keyIterations)Open an encrypted file store with the given settings. |
| public void | |
| public void | readFully(byte[]
the target buffer b, int the offset off, int the number of bytes to read len)Read a number of bytes. |
| public void | readFullyDirect(byte[]
the target buffer b, int the offset off, int the number of bytes to read len)Read a number of bytes without decrypting. |
| public synchronized void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| private static void | |
| public synchronized boolean | |
| public void | write(byte[]
the source buffer b, int the offset off, int the number of bytes to write len)Write a number of bytes. |
| protected void | writeDirect(byte[]
the source buffer b, int the offset off, int the number of bytes to write len)Write a number of bytes without encrypting. |
| ASSERT | back to summary |
|---|---|
| private static final boolean ASSERT | |
| autoDeleteReference | back to summary |
|---|---|
| private Reference<?> autoDeleteReference | |
| checkedWriting | back to summary |
|---|---|
| private boolean checkedWriting | |
| file | back to summary |
|---|---|
| private FileChannel file | |
| fileLength | back to summary |
|---|---|
| private long fileLength | |
| filePos | back to summary |
|---|---|
| private long filePos | |
| handler | back to summary |
|---|---|
| private final DataHandler handler The callback object is responsible to check access rights, and free up disk space if required. | |
| HEADER | back to summary |
|---|---|
| private static final String HEADER The magic file header. | |
| HEADER_LENGTH | back to summary |
|---|---|
| public static final int HEADER_LENGTH The size of the file header in bytes. | |
| lock | back to summary |
|---|---|
| private FileLock lock | |
| mode | back to summary |
|---|---|
| private final String mode | |
| name | back to summary |
|---|---|
| protected String name The file name. | |
| FileStore | back to summary |
|---|---|
| protected FileStore(DataHandler handler, String name, String mode) Create a new file using the given settings.
| |
| autoDelete | back to summary |
|---|---|
| public void autoDelete() Automatically delete the file once it is no longer in use. | |
| checkPowerOff | back to summary |
|---|---|
| private void checkPowerOff() | |
| checkWritingAllowed | back to summary |
|---|---|
| private void checkWritingAllowed() | |
| close | back to summary |
|---|---|
| public void close() Close the file. | |
| closeAndDeleteSilently | back to summary |
|---|---|
| public void closeAndDeleteSilently() Close the file (ignoring exceptions) and delete the file. | |
| closeFile | back to summary |
|---|---|
| public void closeFile() throws IOException Close the file. The file may later be re-opened using openFile.
| |
| closeFileSilently | back to summary |
|---|---|
| private void closeFileSilently() Just close the file, without setting the reference to null. This method is called when writing failed. The reference is not set to null so that there are no NullPointerExceptions later on. | |
| closeSilently | back to summary |
|---|---|
| public void closeSilently() Close the file without throwing any exceptions. Exceptions are simply ignored. | |
| generateSalt | back to summary |
|---|---|
| protected byte[] generateSalt() Generate the random salt bytes if required.
| |
| getFilePointer | back to summary |
|---|---|
| public long getFilePointer() Get the current location of the file pointer.
| |
| init | back to summary |
|---|---|
| public void init() Initialize the file. This method will write or check the file header if required. | |
| initKey | back to summary |
|---|---|
| protected void initKey(byte[] salt) Initialize the key using the given salt.
| |
| length | back to summary |
|---|---|
| public long length() Get the file size in bytes.
| |
| open | back to summary |
|---|---|
| public static FileStore open(DataHandler handler, String name, String mode) Open a non encrypted file store with the given settings.
| |
| open | back to summary |
|---|---|
| public static FileStore open(DataHandler handler, String name, String mode, String cipher, byte[] key) Open an encrypted file store with the given settings.
| |
| open | back to summary |
|---|---|
| public static FileStore open(DataHandler handler, String name, String mode, String cipher, byte[] key, int keyIterations) Open an encrypted file store with the given settings.
| |
| openFile | back to summary |
|---|---|
| public void openFile() throws IOException Re-open the file. The file pointer will be reset to the previous location.
| |
| readFully | back to summary |
|---|---|
| public void readFully(byte[] b, int off, int len) Read a number of bytes.
| |
| readFullyDirect | back to summary |
|---|---|
| public void readFullyDirect(byte[] b, int off, int len) Read a number of bytes without decrypting.
| |
| releaseLock | back to summary |
|---|---|
| public synchronized void releaseLock() Release the file lock. | |
| seek | back to summary |
|---|---|
| public void seek(long pos) Go to the specified file location.
| |
| setCheckedWriting | back to summary |
|---|---|
| public void setCheckedWriting(boolean value) | |
| setLength | back to summary |
|---|---|
| public void setLength(long newLength) Set the length of the file. This will expand or shrink the file.
| |
| stopAutoDelete | back to summary |
|---|---|
| public void stopAutoDelete() No longer automatically delete the file once it is no longer in use. | |
| sync | back to summary |
|---|---|
| public void sync() Call fsync. Depending on the operating system and hardware, this may or may not in fact write the changes. | |
| trace | back to summary |
|---|---|
| private static void trace(String method, String fileName, Object o) | |
| tryLock | back to summary |
|---|---|
| public synchronized boolean tryLock() Try to lock the file.
| |
| write | back to summary |
|---|---|
| public void write(byte[] b, int off, int len) Write a number of bytes.
| |
| writeDirect | back to summary |
|---|---|
| protected void writeDirect(byte[] b, int off, int len) Write a number of bytes without encrypting.
| |