Package org.h2.store.fs
Class FileBaseDefault
- java.lang.Object
-
- java.nio.channels.spi.AbstractInterruptibleChannel
-
- java.nio.channels.FileChannel
-
- org.h2.store.fs.FileBase
-
- org.h2.store.fs.FileBaseDefault
-
- 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
- Direct Known Subclasses:
FileAsync
,FileEncrypt
,FileMem
,FileNioMapped
,FileNioMem
,FileSplit
public abstract class FileBaseDefault extends FileBase
Default implementation of the slow operations that need synchronization because they involve the file position.
-
-
Field Summary
Fields Modifier and Type Field Description private long
position
-
Constructor Summary
Constructors Constructor Description FileBaseDefault()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
implTruncate(long size)
The truncate implementation.long
position()
java.nio.channels.FileChannel
position(long newPosition)
int
read(java.nio.ByteBuffer dst)
java.nio.channels.FileChannel
truncate(long newLength)
int
write(java.nio.ByteBuffer src)
-
Methods inherited from class org.h2.store.fs.FileBase
force, implCloseChannel, lock, map, read, read, transferFrom, transferTo, tryLock, write, write
-
Methods inherited from class java.nio.channels.FileChannel
lock, open, open, read, size, tryLock, write
-
Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel
begin, close, end, isOpen
-
-
-
-
Method Detail
-
position
public final long position() throws java.io.IOException
- Specified by:
position
in interfacejava.nio.channels.SeekableByteChannel
- Specified by:
position
in classjava.nio.channels.FileChannel
- Throws:
java.io.IOException
-
position
public final java.nio.channels.FileChannel position(long newPosition) throws java.io.IOException
- Specified by:
position
in interfacejava.nio.channels.SeekableByteChannel
- Specified by:
position
in classjava.nio.channels.FileChannel
- Throws:
java.io.IOException
-
read
public final int read(java.nio.ByteBuffer dst) throws java.io.IOException
- Specified by:
read
in interfacejava.nio.channels.ReadableByteChannel
- Specified by:
read
in interfacejava.nio.channels.SeekableByteChannel
- Specified by:
read
in classjava.nio.channels.FileChannel
- Throws:
java.io.IOException
-
write
public final int write(java.nio.ByteBuffer src) throws java.io.IOException
- Specified by:
write
in interfacejava.nio.channels.SeekableByteChannel
- Specified by:
write
in interfacejava.nio.channels.WritableByteChannel
- Specified by:
write
in classjava.nio.channels.FileChannel
- Throws:
java.io.IOException
-
truncate
public final java.nio.channels.FileChannel truncate(long newLength) throws java.io.IOException
- Specified by:
truncate
in interfacejava.nio.channels.SeekableByteChannel
- Specified by:
truncate
in classjava.nio.channels.FileChannel
- Throws:
java.io.IOException
-
implTruncate
protected abstract void implTruncate(long size) throws java.io.IOException
The truncate implementation.- Parameters:
size
- the new size- Throws:
java.io.IOException
- on failure
-
-