Package org.h2.store.fs.niomem
Class FileNioMem
- 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.niomem.FileNioMem
-
- 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
class FileNioMem extends FileBaseDefault
This class represents an in-memory file.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
closed
(package private) FileNioMemData
data
The file data.private boolean
readOnly
-
Constructor Summary
Constructors Constructor Description FileNioMem(FileNioMemData data, boolean readOnly)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
force(boolean metaData)
void
implCloseChannel()
protected void
implTruncate(long newLength)
The truncate implementation.int
read(java.nio.ByteBuffer dst, long position)
long
size()
java.lang.String
toString()
java.nio.channels.FileLock
tryLock(long position, long size, boolean shared)
int
write(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
-
data
final FileNioMemData data
The file data.
-
readOnly
private final boolean readOnly
-
closed
private volatile boolean closed
-
-
Constructor Detail
-
FileNioMem
FileNioMem(FileNioMemData data, boolean readOnly)
-
-
Method Detail
-
size
public long size()
- Specified by:
size
in interfacejava.nio.channels.SeekableByteChannel
- Specified by:
size
in classjava.nio.channels.FileChannel
-
implTruncate
protected void implTruncate(long newLength) throws java.io.IOException
Description copied from class:FileBaseDefault
The truncate implementation.- Specified by:
implTruncate
in classFileBaseDefault
- Parameters:
newLength
- the new size- Throws:
java.io.IOException
- on failure
-
write
public int write(java.nio.ByteBuffer src, long position) throws java.io.IOException
-
read
public int read(java.nio.ByteBuffer dst, long position) throws java.io.IOException
-
implCloseChannel
public void implCloseChannel() throws java.io.IOException
- Overrides:
implCloseChannel
in classFileBase
- Throws:
java.io.IOException
-
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:
toString
in classjava.lang.Object
-
-