|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.me.parabola.imgfmt.sys.FileNode
public class FileNode
The internal representation of a file in the file system. In use it
should only be referred to by the ImgChannel
interface.
Constructor Summary | |
---|---|
FileNode(java.nio.channels.FileChannel file,
uk.me.parabola.imgfmt.sys.Dirent dir,
java.lang.String mode)
Creates a new file in the file system. |
Method Summary | |
---|---|
void |
close()
Closes this channel. |
boolean |
isOpen()
Tells whether or not this channel is open. |
long |
position()
Get the file position. |
void |
position(long pos)
Set the position within the file. |
int |
read(java.nio.ByteBuffer dst)
Reads a sequence of bytes from this channel into the given buffer. |
void |
setXorByte(byte xorByte)
|
int |
write(java.nio.ByteBuffer src)
Writes a sequence of bytes to this channel from the given buffer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileNode(java.nio.channels.FileChannel file, uk.me.parabola.imgfmt.sys.Dirent dir, java.lang.String mode)
file
- The handle to the underlying file.dir
- The directory entry associated with this file.mode
- The mode "rw" for read and write etc.Method Detail |
---|
public void close() throws java.io.IOException
After a channel is closed, any further attempt to invoke I/O
operations upon it will cause a ClosedChannelException
to be
thrown.
If this channel is already closed then invoking this method has no effect.
This method may be invoked at any time. If some other thread has already invoked it, however, then another invocation will block until the first invocation is complete, after which it will return without effect.
close
in interface java.io.Closeable
close
in interface java.nio.channels.Channel
java.io.IOException
- If an I/O error occurspublic boolean isOpen()
isOpen
in interface java.nio.channels.Channel
public int read(java.nio.ByteBuffer dst) throws java.io.IOException
read
in interface java.nio.channels.ReadableByteChannel
dst
- The buffer into which bytes are to be transferred
java.nio.channels.NonReadableChannelException
- If this channel was not opened for reading
java.nio.channels.ClosedChannelException
- If this channel is closed
java.nio.channels.AsynchronousCloseException
- If another thread closes this channel
while the read operation is in progress
java.nio.channels.ClosedByInterruptException
- If another thread interrupts the
current thread while the read operation is in progress, thereby closing
the channel and setting the current thread's interrupt status
java.io.IOException
- If some other I/O error occurspublic int write(java.nio.ByteBuffer src) throws java.io.IOException
An attempt is made to write up to r bytes to the channel, where r is the number of bytes remaining in the buffer, that is, dst.remaining(), at the moment this method is invoked.
The logical block has to be converted to a physical block in the underlying file.
write
in interface java.nio.channels.WritableByteChannel
src
- The buffer from which bytes are to be retrieved
java.nio.channels.NonWritableChannelException
- If this channel was not opened for writing
java.nio.channels.ClosedChannelException
- If this channel is closed
java.io.IOException
- If some other I/O error occurspublic long position()
ImgChannel
position
in interface ImgChannel
public void position(long pos)
ImgChannel
position
in interface ImgChannel
pos
- The position to set.public void setXorByte(byte xorByte)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |