|
|||||||||
| Home >> All >> java >> nio >> [ channels overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.nio.channels
Class FileChannel

java.lang.Objectjava.nio.channels.spi.AbstractInterruptibleChannel
java.nio.channels.FileChannel
- All Implemented Interfaces:
- ByteChannel, Channel, GatheringByteChannel, InterruptibleChannel, ReadableByteChannel, ScatteringByteChannel, WritableByteChannel
- public abstract class FileChannel
- extends java.nio.channels.spi.AbstractInterruptibleChannel
- implements ByteChannel, GatheringByteChannel, ScatteringByteChannel
- extends java.nio.channels.spi.AbstractInterruptibleChannel
- Since:
- 1.4
| Nested Class Summary | |
static class |
FileChannel.MapMode
|
| Field Summary |
| Fields inherited from class java.nio.channels.spi.AbstractInterruptibleChannel |
|
| Constructor Summary | |
protected |
FileChannel()
Initializes the channel. |
| Method Summary | |
abstract void |
force(boolean metaData)
msync with the disk |
protected abstract void |
implCloseChannel()
Closes the channel. |
FileLock |
lock()
Creates a file lock for the whole associated file. |
abstract FileLock |
lock(long position,
long size,
boolean shared)
Creates a file lock for a region of the associated file. |
abstract java.nio.MappedByteBuffer |
map(FileChannel.MapMode mode,
long position,
long size)
Maps the file into the memory. |
abstract long |
position()
Returns the current position on the file. |
abstract FileChannel |
position(long newPosition)
Sets the position of the channel on the assoziated file. |
abstract int |
read(java.nio.ByteBuffer dst)
Reads data from the channel. |
long |
read(java.nio.ByteBuffer[] dsts)
Reads data from the channel. |
abstract long |
read(java.nio.ByteBuffer[] dsts,
int offset,
int length)
Reads data from the channel. |
abstract int |
read(java.nio.ByteBuffer dst,
long position)
Reads data from the channel. |
abstract long |
size()
Return the size of the file thus far |
abstract long |
transferFrom(ReadableByteChannel src,
long position,
long count)
Transfers bytes from the given readable channel into this channel. |
abstract long |
transferTo(long position,
long count,
WritableByteChannel target)
Transfers bytes from this channel's file to the given writable byte channel. |
abstract FileChannel |
truncate(long size)
Truncates the channel's file at size. |
FileLock |
tryLock()
Tries to aqquire alock on the whole associated file. |
abstract FileLock |
tryLock(long position,
long size,
boolean shared)
Tries to aqquire a lock on a region of the associated file. |
abstract int |
write(java.nio.ByteBuffer src)
Writes data to the channel. |
long |
write(java.nio.ByteBuffer[] srcs)
Writes data to the channel. |
abstract long |
write(java.nio.ByteBuffer[] srcs,
int offset,
int length)
Writes data to the channel. |
abstract int |
write(java.nio.ByteBuffer srcs,
long position)
Writes data to the channel. |
| Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel |
begin, close, end, isOpen |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.nio.channels.Channel |
close, isOpen |
| Constructor Detail |
FileChannel
protected FileChannel()
- Initializes the channel.
| Method Detail |
map
public abstract java.nio.MappedByteBuffer map(FileChannel.MapMode mode, long position, long size) throws java.io.IOException
- Maps the file into the memory.
size
public abstract long size()
throws java.io.IOException
- Return the size of the file thus far
write
public final long write(java.nio.ByteBuffer[] srcs) throws java.io.IOException
- Writes data to the channel.
- Specified by:
writein interfaceGatheringByteChannel
write
public abstract int write(java.nio.ByteBuffer src) throws java.io.IOException
- Writes data to the channel.
- Specified by:
writein interfaceWritableByteChannel
write
public abstract int write(java.nio.ByteBuffer srcs, long position) throws java.io.IOException
- Writes data to the channel.
write
public abstract long write(java.nio.ByteBuffer[] srcs, int offset, int length) throws java.io.IOException
- Writes data to the channel.
- Specified by:
writein interfaceGatheringByteChannel
read
public abstract long read(java.nio.ByteBuffer[] dsts, int offset, int length) throws java.io.IOException
- Reads data from the channel.
- Specified by:
readin interfaceScatteringByteChannel
read
public final long read(java.nio.ByteBuffer[] dsts) throws java.io.IOException
- Reads data from the channel.
- Specified by:
readin interfaceScatteringByteChannel
read
public abstract int read(java.nio.ByteBuffer dst) throws java.io.IOException
- Reads data from the channel.
- Specified by:
readin interfaceReadableByteChannel
read
public abstract int read(java.nio.ByteBuffer dst, long position) throws java.io.IOException
- Reads data from the channel.
implCloseChannel
protected abstract void implCloseChannel()
throws java.io.IOException
- Closes the channel.
This is called from @see close.
force
public abstract void force(boolean metaData)
throws java.io.IOException
- msync with the disk
lock
public final FileLock lock() throws java.io.IOException
- Creates a file lock for the whole associated file.
lock
public abstract FileLock lock(long position, long size, boolean shared) throws java.io.IOException
- Creates a file lock for a region of the associated file.
tryLock
public final FileLock tryLock() throws java.io.IOException
- Tries to aqquire alock on the whole associated file.
tryLock
public abstract FileLock tryLock(long position, long size, boolean shared) throws java.io.IOException
- Tries to aqquire a lock on a region of the associated file.
position
public abstract long position()
throws java.io.IOException
- Returns the current position on the file.
position
public abstract FileChannel position(long newPosition) throws java.io.IOException
- Sets the position of the channel on the assoziated file.
transferTo
public abstract long transferTo(long position,
long count,
WritableByteChannel target)
throws java.io.IOException
- Transfers bytes from this channel's file to the given writable byte
channel.
transferFrom
public abstract long transferFrom(ReadableByteChannel src, long position, long count) throws java.io.IOException
- Transfers bytes from the given readable channel into this channel.
truncate
public abstract FileChannel truncate(long size) throws java.io.IOException
- Truncates the channel's file at
size.
|
|||||||||
| Home >> All >> java >> nio >> [ channels overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC