| Modifier and Type | Field and Description |
|---|---|
| private FileChannel | |
| private long | |
| private static final int | |
| private MappedByteBuffer | |
| private final FileChannel. | |
| private final String |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| public void | force(boolean
If metaData)true then this method is required to force changes
to both the file's content and metadata to be written to
storage; otherwise, it need only force content changes to be
writtenOverrides org. Forces any updates to this channel's file to be written to the storage device that contains it. |
| public void | |
| protected void | implTruncate(long
the new size newLength)Implements abstract org. The truncate implementation. |
| public synchronized int | read(ByteBuffer
The buffer into which bytes are to be transferred dst, long The file position at which the transfer is to begin;
must be non-negative pos)Overrides org. Reads a sequence of bytes from this channel into the given buffer, starting at the given file position. |
| private void | |
| public synchronized void | |
| public synchronized long | size()
Implements abstract java. Implements java. Returns the current size of this channel's file. |
| public String | |
| public synchronized FileLock | tryLock(long
The position at which the locked region is to start; must be
non-negative position, long The size of the locked region; must be non-negative, and the sum
size, boolean position + size must be non-negative.
A value of zero means to lock all bytes from the specified
starting position to the end of the file, regardless of whether
the file is subsequently extended or truncatedtrue to request a shared lock,
false to request an exclusive lockOverrides org. Attempts to acquire a lock on the given region of this channel's file. |
| private void | |
| public synchronized int | write(ByteBuffer
The buffer from which bytes are to be transferred src, long The file position at which the transfer is to begin;
must be non-negative position)Overrides org. Writes a sequence of bytes to this channel from the given buffer, starting at the given file position. |
| channel | back to summary |
|---|---|
| private FileChannel channel | |
| fileLength | back to summary |
|---|---|
| private long fileLength | |
| GC_TIMEOUT_MS | back to summary |
|---|---|
| private static final int GC_TIMEOUT_MS | |
| mapped | back to summary |
|---|---|
| private MappedByteBuffer mapped | |
| mode | back to summary |
|---|---|
| private final FileChannel. | |
| name | back to summary |
|---|---|
| private final String name | |
| FileNioMapped | back to summary |
|---|---|
| pack-priv FileNioMapped(String fileName, String mode) throws IOException | |
| checkFileSizeLimit | back to summary |
|---|---|
| private static void checkFileSizeLimit(long length) throws IOException | |
| force | back to summary |
|---|---|
| public void force(boolean metaData) throws IOException Overrides org. Doc from java. Forces any updates to this channel's file to be written to the storage device that contains it. If this channel's file resides on a local storage device then when this method returns it is guaranteed that all changes made to the file since this channel was created, or since this method was last invoked, will have been written to that device. This is useful for ensuring that critical information is not lost in the event of a system crash. If the file does not reside on a local device then no such guarantee is made. The Invoking this method may cause an I/O operation to occur even if the channel was only opened for reading. Some operating systems, for example, maintain a last-access time as part of a file's metadata, and this time is updated whenever the file is read. Whether or not this is actually done is system-dependent and is therefore unspecified. This method is only guaranteed to force changes that were made to
this channel's file via the methods defined in this class, or the methods
defined by
| |
| implCloseChannel | back to summary |
|---|---|
| public void implCloseChannel() throws IOException Overrides org. Doc from java. Closes this channel. This method is invoked by the An implementation of this method must arrange for any other thread that is blocked in an I/O operation upon this channel to return immediately, either by throwing an exception or by returning normally.
| |
| implTruncate | back to summary |
|---|---|
| protected void implTruncate(long newLength) throws IOException Implements abstract org. Doc from org. The truncate implementation.
| |
| read | back to summary |
|---|---|
| public synchronized int read(ByteBuffer dst, long pos) throws IOException Overrides org. Doc from java. Reads a sequence of bytes from this channel into the given buffer, starting at the given file position. This method works in the same manner as the
| |
| reMap | back to summary |
|---|---|
| private void reMap() throws IOException Re-map byte buffer into memory, called when file size has changed or file was created. | |
| setFileLength | back to summary |
|---|---|
| public synchronized void setFileLength(long newLength) throws IOException | |
| size | back to summary |
|---|---|
| public synchronized long size() throws IOException Implements abstract java. Implements java. Doc from java. Returns the current size of this channel's file.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| tryLock | back to summary |
|---|---|
| public synchronized FileLock tryLock(long position, long size, boolean shared) throws IOException Overrides org. Doc from java. Attempts to acquire a lock on the given region of this channel's file. This method does not block. An invocation always returns
immediately, either having acquired a lock on the requested region or
having failed to do so. If it fails to acquire a lock because an
overlapping lock is held by another program then it returns
The region specified by the Some operating systems do not support shared locks, in which case a
request for a shared lock is automatically converted into a request for
an exclusive lock. Whether the newly-acquired lock is shared or
exclusive may be tested by invoking the resulting lock object's File locks are held on behalf of the entire Java virtual machine. They are not suitable for controlling access to a file by multiple threads within the same virtual machine.
| |
| unMap | back to summary |
|---|---|
| private void unMap() throws IOException | |
| write | back to summary |
|---|---|
| public synchronized int write(ByteBuffer src, long position) throws IOException Overrides org. Doc from java. Writes a sequence of bytes to this channel from the given buffer, starting at the given file position. This method works in the same manner as the If the file is open in append mode, then the effect of invoking this method is unspecified.
| |