Package org.cryptomator.cryptofs.ch
Class CleartextFileChannel
- java.lang.Object
-
- java.nio.channels.spi.AbstractInterruptibleChannel
-
- java.nio.channels.FileChannel
-
- org.cryptomator.cryptofs.ch.AbstractFileChannel
-
- org.cryptomator.cryptofs.ch.CleartextFileChannel
-
- All Implemented Interfaces:
Closeable,AutoCloseable,ByteChannel,Channel,GatheringByteChannel,InterruptibleChannel,ReadableByteChannel,ScatteringByteChannel,SeekableByteChannel,WritableByteChannel
@ChannelScoped public class CleartextFileChannel extends AbstractFileChannel
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.nio.channels.FileChannel
FileChannel.MapMode
-
-
Field Summary
-
Fields inherited from class org.cryptomator.cryptofs.ch.AbstractFileChannel
position
-
-
Constructor Summary
Constructors Constructor Description CleartextFileChannel(FileChannel ciphertextFileChannel, org.cryptomator.cryptolib.api.FileHeader fileHeader, boolean mustWriteHeader, ReadWriteLock readWriteLock, org.cryptomator.cryptolib.api.Cryptor cryptor, ChunkCache chunkCache, EffectiveOpenOptions options, AtomicLong fileSize, AtomicReference<Instant> lastModified, Supplier<BasicFileAttributeView> attrViewProvider, ExceptionsDuringWrite exceptionsDuringWrite, ChannelCloseListener closeListener, CryptoFileSystemStats stats)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidforce(boolean metaData)protected voidimplCloseChannel()protected booleanisReadable()protected booleanisWritable()FileLocklock(long pos, long size, boolean shared)MappedByteBuffermap(FileChannel.MapMode mode, long position, long size)protected intreadLocked(ByteBuffer dst, long position)longsize()protected voidtruncateLocked(long newSize)FileLocktryLock(long pos, long size, boolean shared)protected intwriteLocked(ByteBuffer src, long position)-
Methods inherited from class org.cryptomator.cryptofs.ch.AbstractFileChannel
assertOpen, assertReadable, assertWritable, beginBlocking, endBlocking, position, position, read, read, read, transferFrom, transferFromLocked, transferTo, transferToLocked, truncate, write, write, write
-
Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel
begin, close, end, isOpen
-
-
-
-
Constructor Detail
-
CleartextFileChannel
@Inject public CleartextFileChannel(FileChannel ciphertextFileChannel, org.cryptomator.cryptolib.api.FileHeader fileHeader, @MustWriteHeader boolean mustWriteHeader, ReadWriteLock readWriteLock, org.cryptomator.cryptolib.api.Cryptor cryptor, ChunkCache chunkCache, EffectiveOpenOptions options, @OpenFileSize AtomicLong fileSize, @OpenFileModifiedDate AtomicReference<Instant> lastModified, Supplier<BasicFileAttributeView> attrViewProvider, ExceptionsDuringWrite exceptionsDuringWrite, ChannelCloseListener closeListener, CryptoFileSystemStats stats)
-
-
Method Detail
-
size
public long size() throws IOException- Specified by:
sizein interfaceSeekableByteChannel- Specified by:
sizein classFileChannel- Throws:
IOException
-
isWritable
protected boolean isWritable()
- Specified by:
isWritablein classAbstractFileChannel
-
isReadable
protected boolean isReadable()
- Specified by:
isReadablein classAbstractFileChannel
-
readLocked
protected int readLocked(ByteBuffer dst, long position) throws IOException
- Specified by:
readLockedin classAbstractFileChannel- Throws:
IOException- See Also:
AbstractFileChannel.read(ByteBuffer, long)
-
writeLocked
protected int writeLocked(ByteBuffer src, long position) throws IOException
- Specified by:
writeLockedin classAbstractFileChannel- Throws:
IOException- See Also:
AbstractFileChannel.write(ByteBuffer, long)
-
truncateLocked
protected void truncateLocked(long newSize) throws IOException- Specified by:
truncateLockedin classAbstractFileChannel- Throws:
IOException- See Also:
AbstractFileChannel.truncate(long)
-
force
public void force(boolean metaData) throws IOException- Specified by:
forcein classFileChannel- Throws:
IOException
-
map
public MappedByteBuffer map(FileChannel.MapMode mode, long position, long size)
- Specified by:
mapin classFileChannel
-
lock
public FileLock lock(long pos, long size, boolean shared) throws IOException
- Specified by:
lockin classFileChannel- Throws:
IOException
-
tryLock
public FileLock tryLock(long pos, long size, boolean shared) throws IOException
- Specified by:
tryLockin classFileChannel- Throws:
IOException
-
implCloseChannel
protected void implCloseChannel() throws IOException- Overrides:
implCloseChannelin classAbstractFileChannel- Throws:
IOException
-
-