public abstract class FileIO extends ConcurrentCloseable<IOException> implements IO.KnownSize
| Modifier and Type | Class and Description |
|---|---|
static class |
FileIO.ReadOnly
FileIO in read-only mode.
|
static class |
FileIO.ReadWrite
FileIO with read and write operations.
|
static class |
FileIO.WriteOnly
FileIO in write-only mode.
|
IO.KnownSize, IO.OperationType, IO.OutputToInput, IO.PositionKnown, IO.Readable, IO.ReadableByteStream, IO.Resizable, IO.Seekable, IO.Writable, IO.WritableByteStream, IO.WriterAsyncCloseableListenable.Impl| Modifier and Type | Field and Description |
|---|---|
protected FileAccess |
file |
protected long |
position |
| Modifier | Constructor and Description |
|---|---|
protected |
FileIO(File file,
String mode,
byte priority) |
| Modifier and Type | Method and Description |
|---|---|
IAsync<IOException> |
canStart()
Can start reading or writing.
|
protected void |
closeResources(Async<IOException> ondone) |
protected IAsync<IOException> |
closeUnderlyingResources() |
File |
getFile() |
protected long |
getPosition() |
byte |
getPriority()
Return the priority.
|
AsyncSupplier<Long,IOException> |
getSizeAsync()
Asynchronous operation to get the size of the IO.
|
long |
getSizeSync()
Synchronous operation to get the size of the IO.
|
String |
getSourceDescription()
Describe the IO, which can be used for logging or debugging purposes.
|
TaskManager |
getTaskManager()
Return the TaskManager used for asynchronous operations.
|
IO |
getWrappedIO()
If this IO is wrapping another one (such as adding Buffered capabilities), this method returns it,
or null if it does not wrap another IO.
|
protected AsyncSupplier<Integer,IOException> |
readAsync(ByteBuffer buffer,
Consumer<Pair<Integer,IOException>> ondone) |
protected AsyncSupplier<Integer,IOException> |
readAsync(long pos,
ByteBuffer buffer,
Consumer<Pair<Integer,IOException>> ondone) |
protected AsyncSupplier<Integer,IOException> |
readFullyAsync(ByteBuffer buffer,
Consumer<Pair<Integer,IOException>> ondone) |
protected AsyncSupplier<Integer,IOException> |
readFullyAsync(long pos,
ByteBuffer buffer,
Consumer<Pair<Integer,IOException>> ondone) |
protected int |
readFullySync(ByteBuffer buffer) |
protected int |
readFullySync(long pos,
ByteBuffer buffer) |
protected int |
readSync(ByteBuffer buffer) |
protected int |
readSync(long pos,
ByteBuffer buffer) |
protected AsyncSupplier<Long,IOException> |
seekAsync(IO.Seekable.SeekType type,
long move,
Consumer<Pair<Long,IOException>> ondone) |
protected long |
seekSync(IO.Seekable.SeekType type,
long move) |
void |
setPriority(byte priority)
Set the priority of asynchronous operations.
|
protected AsyncSupplier<Void,IOException> |
setSizeAsync(long size) |
protected void |
setSizeSync(long size) |
protected AsyncSupplier<Long,IOException> |
skipAsync(long n,
Consumer<Pair<Long,IOException>> ondone) |
protected long |
skipSync(long n) |
protected AsyncSupplier<Integer,IOException> |
writeAsync(ByteBuffer buffer,
Consumer<Pair<Integer,IOException>> ondone) |
protected AsyncSupplier<Integer,IOException> |
writeAsync(long pos,
ByteBuffer buffer,
Consumer<Pair<Integer,IOException>> ondone) |
protected int |
writeSync(ByteBuffer buffer) |
protected int |
writeSync(long pos,
ByteBuffer buffer) |
addCloseListener, addCloseListener, close, closeAsync, isClosed, isClosing, lockClose, operation, operation, removeCloseListener, removeCloseListener, unlockCloseclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcancelClosed, error, errorCancelledlockClose, unlockCloseclosecloseAfter, closeAsyncaddCloseListener, addCloseListener, close, isClosed, removeCloseListener, removeCloseListenerprotected FileAccess file
protected long position
public IAsync<IOException> canStart()
public File getFile()
public String getSourceDescription()
IOgetSourceDescription in interface IOpublic IO getWrappedIO()
IOgetWrappedIO in interface IOpublic byte getPriority()
ConcurrentCloseablegetPriority in interface IOgetPriority in class ConcurrentCloseable<IOException>public void setPriority(byte priority)
IOsetPriority in interface IOpublic TaskManager getTaskManager()
IOgetTaskManager in interface IOprotected long getPosition()
protected long seekSync(IO.Seekable.SeekType type, long move) throws IOException
IOExceptionprotected AsyncSupplier<Long,IOException> seekAsync(IO.Seekable.SeekType type, long move, Consumer<Pair<Long,IOException>> ondone)
protected long skipSync(long n)
throws IOException
IOExceptionprotected AsyncSupplier<Long,IOException> skipAsync(long n, Consumer<Pair<Long,IOException>> ondone)
public long getSizeSync()
throws IOException
IO.KnownSizegetSizeSync in interface IO.KnownSizeIOExceptionpublic AsyncSupplier<Long,IOException> getSizeAsync()
IO.KnownSizegetSizeAsync in interface IO.KnownSizeprotected void setSizeSync(long size)
throws IOException
IOExceptionprotected AsyncSupplier<Void,IOException> setSizeAsync(long size)
protected IAsync<IOException> closeUnderlyingResources()
closeUnderlyingResources in class ConcurrentCloseable<IOException>protected void closeResources(Async<IOException> ondone)
closeResources in class ConcurrentCloseable<IOException>protected int readSync(ByteBuffer buffer) throws IOException
IOExceptionprotected int readSync(long pos,
ByteBuffer buffer)
throws IOException
IOExceptionprotected AsyncSupplier<Integer,IOException> readAsync(ByteBuffer buffer, Consumer<Pair<Integer,IOException>> ondone)
protected AsyncSupplier<Integer,IOException> readAsync(long pos, ByteBuffer buffer, Consumer<Pair<Integer,IOException>> ondone)
protected int readFullySync(ByteBuffer buffer) throws IOException
IOExceptionprotected int readFullySync(long pos,
ByteBuffer buffer)
throws IOException
IOExceptionprotected AsyncSupplier<Integer,IOException> readFullyAsync(ByteBuffer buffer, Consumer<Pair<Integer,IOException>> ondone)
protected AsyncSupplier<Integer,IOException> readFullyAsync(long pos, ByteBuffer buffer, Consumer<Pair<Integer,IOException>> ondone)
protected int writeSync(ByteBuffer buffer) throws IOException
IOExceptionprotected int writeSync(long pos,
ByteBuffer buffer)
throws IOException
IOExceptionprotected AsyncSupplier<Integer,IOException> writeAsync(ByteBuffer buffer, Consumer<Pair<Integer,IOException>> ondone)
protected AsyncSupplier<Integer,IOException> writeAsync(long pos, ByteBuffer buffer, Consumer<Pair<Integer,IOException>> ondone)
Copyright © 2019. All rights reserved.