Interface FileReadChannel
-
- All Superinterfaces:
- java.lang.AutoCloseable, java.nio.channels.Channel, java.io.Closeable, java.nio.channels.ReadableByteChannel
- All Known Implementing Classes:
- BufferedFileReadChannelImpl
Deprecated.
@Deprecated public interface FileReadChannel extends java.nio.channels.ReadableByteChannelAReadableByteChannelfor reading bytes from anAppEngineFile.A
FileReadChannelhas a current position within its file which can be bothqueriedandmodified.An instance of
FileReadChannelis obtained via the methodFileService.openReadChannel(AppEngineFile, boolean).A
FileReadChannelis associated with a single App Engine request and may not be used outside of the request in which it is constructed. Therefore an instance ofFileReadChannelshould not be cached between requests. Instead,closethe channel at the end of the request, cache theAppEngineFileor just thepath, and create a newFileReadChannelin a later request.When a
FileReadChannelis constructed the underlying file may optionally be locked. Successful aquisition of the lock means that no other App Engine request will be able to read the underlying file until the lock is released. If a lock is acquired, it will be released when the methodChannel.close()is invoked. When the request terminates,close()will be invoked implicitly if it has not yet been invoked explicitly. Just likeReadableByteChannelIf one thread initiates a read operation upon a channel then any other thread that attempts to initiate another read operation will block until the first operation is complete. This also applies to theposition()andposition(long)apis.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method and Description longposition()Deprecated.Returns this channel's file position;FileReadChannelposition(long newPosition)Deprecated.Sets this channel's file position.
-
-
-
Method Detail
-
position
long position() throws java.io.IOExceptionDeprecated.Returns this channel's file position;- Returns:
- This channel's file position, a non-negative integer counting the number of bytes from the beginning of the file to the current position
- Throws:
java.io.IOException- If any problem occurs
-
position
FileReadChannel position(long newPosition) throws java.io.IOException
Deprecated.Sets this channel's file position.Setting the position to a value that is greater than the file's size will not result in an exception. A later attempt to read bytes at such a position will immediately return an end-of-file indication.
- Parameters:
newPosition- The new position, a non-negative integer counting the number of bytes from the beginning of the file- Returns:
- This channel
- Throws:
java.lang.IllegalArgumentException- If the new position is negativejava.io.IOException- If any other problem occurs
-
-