Class FileMem
- All Implemented Interfaces:
Closeable, AutoCloseable, ByteChannel, Channel, GatheringByteChannel, InterruptibleChannel, ReadableByteChannel, ScatteringByteChannel, SeekableByteChannel, WritableByteChannel
This class represents an in-memory file.
-
Nested Class Summary
Nested classes/interfaces inherited from class FileChannel
FileChannel.MapMode -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean(package private) final FileMemDataThe file data.private final boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidforce(boolean metaData) voidprotected voidimplTruncate(long newLength) The truncate implementation.intread(ByteBuffer dst, long position) longsize()toString()tryLock(long position, long size, boolean shared) intwrite(ByteBuffer src, long position) Methods inherited from class FileBase
lock, map, read, transferFrom, transferTo, writeMethods inherited from class AbstractInterruptibleChannel
begin, close, end, isOpen
-
Field Details
-
data
The file data. -
readOnly
private final boolean readOnly -
closed
private volatile boolean closed
-
-
Constructor Details
-
FileMem
FileMem(FileMemData data, boolean readOnly)
-
-
Method Details
-
size
public long size()- Specified by:
sizein interfaceSeekableByteChannel- Specified by:
sizein classFileChannel
-
implTruncate
Description copied from class:FileBaseDefaultThe truncate implementation.- Specified by:
implTruncatein classFileBaseDefault- Parameters:
newLength- the new size- Throws:
IOException- on failure
-
write
- Overrides:
writein classFileBase- Throws:
IOException
-
read
- Overrides:
readin classFileBase- Throws:
IOException
-
implCloseChannel
- Overrides:
implCloseChannelin classFileBase- Throws:
IOException
-
force
- Overrides:
forcein classFileBase- Throws:
IOException
-
tryLock
- Overrides:
tryLockin classFileBase- Throws:
IOException
-
toString
-