Package org.h2.store.fs.niomapped
Class FileNioMapped
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.niomapped.FileNioMapped
- All Implemented Interfaces:
Closeable,AutoCloseable,ByteChannel,Channel,GatheringByteChannel,InterruptibleChannel,ReadableByteChannel,ScatteringByteChannel,SeekableByteChannel,WritableByteChannel
Uses memory mapped files.
The file size is limited to 2 GB.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.nio.channels.FileChannel
FileChannel.MapMode -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate FileChannelprivate longprivate static final intprivate MappedByteBufferprivate final FileChannel.MapModeprivate final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidcheckFileSizeLimit(long length) voidforce(boolean metaData) voidprotected voidimplTruncate(long newLength) The truncate implementation.intread(ByteBuffer dst, long pos) private voidreMap()Re-map byte buffer into memory, called when file size has changed or file was created.voidsetFileLength(long newLength) longsize()toString()tryLock(long position, long size, boolean shared) private voidunMap()intwrite(ByteBuffer src, long position) Methods inherited from class org.h2.store.fs.FileBaseDefault
position, position, read, truncate, writeMethods inherited from class org.h2.store.fs.FileBase
lock, map, read, transferFrom, transferTo, writeMethods inherited from class java.nio.channels.FileChannel
lock, map, open, open, read, tryLock, writeMethods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel
begin, close, end, isOpen
-
Field Details
-
GC_TIMEOUT_MS
private static final int GC_TIMEOUT_MS- See Also:
-
name
-
mode
-
channel
-
mapped
-
fileLength
private long fileLength
-
-
Constructor Details
-
FileNioMapped
FileNioMapped(String fileName, String mode) throws IOException - Throws:
IOException
-
-
Method Details
-
unMap
- Throws:
IOException
-
reMap
Re-map byte buffer into memory, called when file size has changed or file was created.- Throws:
IOException
-
checkFileSizeLimit
- Throws:
IOException
-
implCloseChannel
- Overrides:
implCloseChannelin classFileBase- Throws:
IOException
-
toString
-
size
- Specified by:
sizein interfaceSeekableByteChannel- Specified by:
sizein classFileChannel- Throws:
IOException
-
read
- Overrides:
readin classFileBase- Throws:
IOException
-
implTruncate
Description copied from class:FileBaseDefaultThe truncate implementation.- Specified by:
implTruncatein classFileBaseDefault- Parameters:
newLength- the new size- Throws:
IOException- on failure
-
setFileLength
- Throws:
IOException
-
force
- Overrides:
forcein classFileBase- Throws:
IOException
-
write
- Overrides:
writein classFileBase- Throws:
IOException
-
tryLock
- Overrides:
tryLockin classFileBase- Throws:
IOException
-