|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.jdbc.LOBFile
org.apache.derby.impl.jdbc.EncryptedLOBFile
class EncryptedLOBFile
This class is a wrapper class on top of StorageRandomAccess to provide common methods to write in encrypted file. This class is NOT thread safe. The user class should take care of synchronization if being used in multi threaded environment.
Field Summary | |
---|---|
private int |
blockSize
Block size for encryption. |
private long |
currentPos
Current file position. |
private DataFactory |
df
Factory object used for encryption and decryption. |
private byte[] |
tail
Leftover bytes. |
private int |
tailSize
Number of actual bytes in tail array. |
Constructor Summary | |
---|---|
EncryptedLOBFile(StorageFile lobFile,
DataFactory df)
Constructs the EncryptedLOBFile object with encryption support. |
Method Summary | |
---|---|
(package private) void |
close()
closes the file. |
private byte[] |
getBlocks(long pos,
int len)
Find the blocks containing the data we are interested in. |
(package private) long |
getFilePointer()
Returns the currrent position in the file. |
(package private) long |
length()
Returns file length. |
(package private) int |
read(byte[] buff,
int off,
int len)
Reads len or remaining bytes in the file (whichever is lower) bytes into buff starting from off position of the buffer. |
(package private) int |
readByte()
Reads one byte from file. |
(package private) void |
seek(long pos)
Sets the current file pointer to specific location. |
(package private) void |
setLength(long size)
Sets the file length to a given size. |
(package private) void |
write(byte[] b)
Write the buffer into file at current position. |
(package private) void |
write(byte[] b,
int off,
int len)
Writes length number of bytes from buffer starting from off position. |
(package private) void |
write(int b)
Writes one byte into the file. |
Methods inherited from class org.apache.derby.impl.jdbc.LOBFile |
---|
getStorageFile |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final int blockSize
private final byte[] tail
private int tailSize
private long currentPos
private final DataFactory df
Constructor Detail |
---|
EncryptedLOBFile(StorageFile lobFile, DataFactory df) throws java.io.FileNotFoundException
lobFile
- StorageFile Object for which file will be createddf
- data factory for encryption and decription
java.io.FileNotFoundException
- if the file exists but is a directory or
cannot be openedMethod Detail |
---|
private byte[] getBlocks(long pos, int len) throws java.io.IOException, StandardException
pos
- first position we are interested inlen
- number of bytes of interest
java.io.IOException
StandardException
long length() throws java.io.IOException
length
in class LOBFile
java.io.IOException
- if an I/O error occurslong getFilePointer()
getFilePointer
in class LOBFile
void seek(long pos) throws java.io.IOException
seek
in class LOBFile
pos
- new position
java.io.IOException
void write(int b) throws java.io.IOException, StandardException
write
in class LOBFile
b
- byte value
java.io.IOException
- if disk operation fails
StandardException
- if error occured during encryption/decryptionvoid write(byte[] b, int off, int len) throws java.io.IOException, StandardException
write
in class LOBFile
b
- byte array containing bytes to be writtenoff
- starting offset of the byte array from where the
data should be written to the filelen
- number of bytes to be written
java.io.IOException
- if disk operation fails
StandardException
- if error occured during encryption/decryptionvoid write(byte[] b) throws java.io.IOException, StandardException
write
in class LOBFile
b
- byte array to be written
java.io.IOException
- if disk operation fails
StandardException
- if error occured during encryption/decryptionvoid close() throws java.io.IOException
close
in class LOBFile
java.io.IOException
int readByte() throws java.io.IOException, StandardException
readByte
in class LOBFile
java.io.IOException
- if disk operation fails
StandardException
- if error occured during encryption/decryptionint read(byte[] buff, int off, int len) throws java.io.IOException, StandardException
read
in class LOBFile
buff
- byte array to fill read bytesoff
- offset of buff where the byte will be writtenlen
- number of bytes to be read
java.io.IOException
- if disk operation fails
StandardException
- if error occured during encryption/decryptionvoid setLength(long size) throws java.io.IOException, StandardException
setLength
in class LOBFile
size
- new file size. Must be lower than file length.
java.io.IOException
- if file i/o fails
StandardException
- if error occured during encryption/decryption
|
Built on Thu 2011-03-10 11:54:14+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |