Package org.h2.store.fs.encrypt
Class FileEncrypt
- java.lang.Object
-
- java.nio.channels.spi.AbstractInterruptibleChannel
-
- java.nio.channels.FileChannel
-
- org.h2.store.fs.FileBase
-
- org.h2.store.fs.FileBaseDefault
-
- org.h2.store.fs.encrypt.FileEncrypt
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.nio.channels.ByteChannel,java.nio.channels.Channel,java.nio.channels.GatheringByteChannel,java.nio.channels.InterruptibleChannel,java.nio.channels.ReadableByteChannel,java.nio.channels.ScatteringByteChannel,java.nio.channels.SeekableByteChannel,java.nio.channels.WritableByteChannel
public class FileEncrypt extends FileBaseDefault
An encrypted file with a read cache.
-
-
Field Summary
Fields Modifier and Type Field Description static intBLOCK_SIZEThe block size.
-
Constructor Summary
Constructors Constructor Description FileEncrypt(java.lang.String name, byte[] encryptionKey, java.nio.channels.FileChannel base)FileEncrypt(java.lang.String name, FileEncrypt source, java.nio.channels.FileChannel base)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidforce(boolean metaData)protected voidimplCloseChannel()protected voidimplTruncate(long newSize)The truncate implementation.intread(java.nio.ByteBuffer dst, long position)longsize()java.lang.StringtoString()java.nio.channels.FileLocktryLock(long position, long size, boolean shared)intwrite(java.nio.ByteBuffer src, long position)-
Methods inherited from class org.h2.store.fs.FileBaseDefault
position, position, read, truncate, write
-
Methods inherited from class org.h2.store.fs.FileBase
lock, map, read, transferFrom, transferTo, write
-
Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel
begin, close, end, isOpen
-
-
-
-
Field Detail
-
BLOCK_SIZE
public static final int BLOCK_SIZE
The block size.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FileEncrypt
public FileEncrypt(java.lang.String name, byte[] encryptionKey, java.nio.channels.FileChannel base)
-
FileEncrypt
public FileEncrypt(java.lang.String name, FileEncrypt source, java.nio.channels.FileChannel base)
-
-
Method Detail
-
implCloseChannel
protected void implCloseChannel() throws java.io.IOException- Overrides:
implCloseChannelin classFileBase- Throws:
java.io.IOException
-
read
public int read(java.nio.ByteBuffer dst, long position) throws java.io.IOException
-
write
public int write(java.nio.ByteBuffer src, long position) throws java.io.IOException
-
size
public long size() throws java.io.IOException- Specified by:
sizein interfacejava.nio.channels.SeekableByteChannel- Specified by:
sizein classjava.nio.channels.FileChannel- Throws:
java.io.IOException
-
implTruncate
protected void implTruncate(long newSize) throws java.io.IOExceptionDescription copied from class:FileBaseDefaultThe truncate implementation.- Specified by:
implTruncatein classFileBaseDefault- Parameters:
newSize- the new size- Throws:
java.io.IOException- on failure
-
force
public void force(boolean metaData) throws java.io.IOException
-
tryLock
public java.nio.channels.FileLock tryLock(long position, long size, boolean shared) throws java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-