Package java.nio.channels
Class FileChannel
java.lang.Object
java.nio.channels.spi.AbstractInterruptibleChannel
java.nio.channels.FileChannel
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Channel
,GatheringByteChannel
,InterruptibleChannel
,ReadableByteChannel
,ScatteringByteChannel
,WritableByteChannel
public abstract class FileChannel
extends AbstractInterruptibleChannel
implements GatheringByteChannel, ScatteringByteChannel
Compatibility stub.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
force
(boolean metaData) final FileLock
lock()
abstract FileLock
lock
(long position, long size, boolean shared) abstract MappedByteBuffer
map
(FileChannel.MapMode mode, long position, long size) static FileChannel
open
(Path path, OpenOption... options) abstract long
position()
abstract FileChannel
position
(long newPosition) abstract int
read
(ByteBuffer dst) final long
read
(ByteBuffer[] dsts) abstract long
read
(ByteBuffer[] dsts, int offset, int length) abstract int
read
(ByteBuffer dst, long position) abstract long
size()
abstract long
transferFrom
(ReadableByteChannel src, long position, long count) abstract long
transferTo
(long position, long count, WritableByteChannel target) abstract FileChannel
truncate
(long size) final FileLock
tryLock()
abstract FileLock
tryLock
(long position, long size, boolean shared) abstract int
write
(ByteBuffer src) final long
write
(ByteBuffer[] srcs) abstract long
write
(ByteBuffer[] srcs, int offset, int length) abstract int
write
(ByteBuffer src, long position) Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel
begin, close, end, implCloseChannel, isOpen
-
Constructor Details
-
FileChannel
protected FileChannel()
-
-
Method Details
-
open
- Throws:
IOException
-
read
- Specified by:
read
in interfaceReadableByteChannel
- Throws:
IOException
-
read
- Specified by:
read
in interfaceScatteringByteChannel
- Throws:
IOException
-
read
- Specified by:
read
in interfaceScatteringByteChannel
- Throws:
IOException
-
write
- Specified by:
write
in interfaceWritableByteChannel
- Throws:
IOException
-
write
- Specified by:
write
in interfaceGatheringByteChannel
- Throws:
IOException
-
write
- Specified by:
write
in interfaceGatheringByteChannel
- Throws:
IOException
-
position
- Throws:
IOException
-
position
- Throws:
IOException
-
size
- Throws:
IOException
-
truncate
- Throws:
IOException
-
force
- Throws:
IOException
-
transferTo
public abstract long transferTo(long position, long count, WritableByteChannel target) throws IOException - Throws:
IOException
-
transferFrom
public abstract long transferFrom(ReadableByteChannel src, long position, long count) throws IOException - Throws:
IOException
-
read
- Throws:
IOException
-
write
- Throws:
IOException
-
map
public abstract MappedByteBuffer map(FileChannel.MapMode mode, long position, long size) throws IOException - Throws:
IOException
-
lock
- Throws:
IOException
-
lock
- Throws:
IOException
-
tryLock
- Throws:
IOException
-
tryLock
- Throws:
IOException
-