API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.nio.channels. FileChannel View Source
Author(s)
Mark Reinhold
Mike McCloskey
JSR-51 Expert Group
Since
1.4
Version
1.43, 05/11/17
Serial
Hierarchy
 Object
      AbstractInterruptibleChannel
          FileChannel
Implements
 ByteChannel
 GatheringByteChannel
 ScatteringByteChannel
Subclasses
Description
publicabstract abstract class FileChannel
  A channel for reading, writing, mapping, and manipulating a file.
Constructors
protected FileChannel ()
Initializes a new instance of this class.
Methods
Hide/Show inherited methods
protectedfinal void begin () [Inherited From AbstractInterruptibleChannel]
  Marks the beginning of an I/O operation that might block indefinitely.
publicfinal void close () throws IOException [Inherited From AbstractInterruptibleChannel]
  Closes this channel.
protectedfinal void end (boolean completed) throws AsynchronousCloseException [Inherited From AbstractInterruptibleChannel]
  Marks the end of an I/O operation that might block indefinitely.
publicabstract void force (boolean metaData) throws IOException
  Forces any updates to this channel's file to be written to the storage device that contains it.
protectedabstract void implCloseChannel () throws IOException [Inherited From AbstractInterruptibleChannel]
  Closes this channel.
publicfinal boolean isOpen () [Inherited From AbstractInterruptibleChannel]
publicfinal FileLock lock () throws IOException
  Acquires an exclusive lock on this channel's file.
publicabstract FileLock lock (long position, long size, boolean shared) throws IOException
  Acquires a lock on the given region of this channel's file.
publicabstract MappedByteBuffer map (MapMode mode, long position, long size) throws IOException
  Maps a region of this channel's file directly into memory.
publicabstract long position () throws IOException
  Returns this channel's file position.
publicabstract FileChannel position (long newPosition) throws IOException
  Sets this channel's file position.
publicabstract int read (ByteBuffer dst) throws IOException
  Reads a sequence of bytes from this channel into the given buffer.
publicfinal long read (ByteBuffer dsts) throws IOException [Specified in ScatteringByteChannel]
  Reads a sequence of bytes from this channel into the given buffers.
publicabstract long read (ByteBuffer dsts, int offset, int length) throws IOException [Specified in ScatteringByteChannel]
  Reads a sequence of bytes from this channel into a subsequence of the given buffers.
publicabstract int read (ByteBuffer dst, long position) throws IOException
  Reads a sequence of bytes from this channel into the given buffer, starting at the given file position.
publicabstract long size () throws IOException
  Returns the current size of this channel's file.
publicabstract long transferFrom (ReadableByteChannel src, long position, long count) throws IOException
  Transfers bytes into this channel's file from the given readable byte channel.
publicabstract long transferTo (long position, long count, WritableByteChannel target) throws IOException
  Transfers bytes from this channel's file to the given writable byte channel.
publicabstract FileChannel truncate (long size) throws IOException
  Truncates this channel's file to the given size.
publicfinal FileLock tryLock () throws IOException
  Attempts to acquire an exclusive lock on this channel's file.
publicabstract FileLock tryLock (long position, long size, boolean shared) throws IOException
  Attempts to acquire a lock on the given region of this channel's file.
publicabstract int write (ByteBuffer src) throws IOException
  Writes a sequence of bytes to this channel from the given buffer.
publicfinal long write (ByteBuffer srcs) throws IOException [Specified in GatheringByteChannel]
  Writes a sequence of bytes to this channel from the given buffers.
publicabstract long write (ByteBuffer srcs, int offset, int length) throws IOException [Specified in GatheringByteChannel]
  Writes a sequence of bytes to this channel from a subsequence of the given buffers.
publicabstract int write (ByteBuffer src, long position) throws IOException
  Writes a sequence of bytes to this channel from the given buffer, starting at the given file position.
Fields
Hide/Show inherited fields
Nested Classes
  FileChannel.MapMode
A typesafe enumeration for file-mapping modes.
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar