Package io.activej.csp.file
Class ChannelFileReader
java.lang.Object
io.activej.async.process.AbstractAsyncCloseable
io.activej.csp.AbstractChannelSupplier<io.activej.bytebuf.ByteBuf>
io.activej.csp.file.ChannelFileReader
- All Implemented Interfaces:
io.activej.async.process.AsyncCloseable,io.activej.common.initializer.WithInitializer<ChannelFileReader>,ChannelSupplier<io.activej.bytebuf.ByteBuf>
public final class ChannelFileReader
extends AbstractChannelSupplier<io.activej.bytebuf.ByteBuf>
implements io.activej.common.initializer.WithInitializer<ChannelFileReader>
This supplier allows you to asynchronously read binary data from a file.
-
Field Summary
FieldsFields inherited from class io.activej.csp.AbstractChannelSupplier
CHECKFields inherited from class io.activej.async.process.AbstractAsyncCloseable
eventloopFields inherited from interface io.activej.async.process.AsyncCloseable
STATIC -
Method Summary
Modifier and TypeMethodDescriptionstatic ChannelFileReadercreate(io.activej.async.file.AsyncFileService fileService, FileChannel channel) static ChannelFileReadercreate(Executor executor, FileChannel channel) protected io.activej.promise.Promise<io.activej.bytebuf.ByteBuf>doGet()longprotected voidstatic io.activej.promise.Promise<ChannelFileReader>static io.activej.promise.Promise<ChannelFileReader>open(Executor executor, Path path, OpenOption... openOptions) static ChannelFileReaderopenBlocking(Executor executor, Path path) static ChannelFileReaderopenBlocking(Executor executor, Path path, OpenOption... openOptions) toString()withBufferSize(int bufferSize) withBufferSize(io.activej.common.MemSize bufferSize) withLimit(long limit) withOffset(long offset) Methods inherited from class io.activej.csp.AbstractChannelSupplier
getMethods inherited from class io.activej.async.process.AbstractAsyncCloseable
closeEx, doSanitize, getException, isClosed, onCleanup, sanitize, setCloseableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.activej.async.process.AsyncCloseable
close, closeExMethods inherited from interface io.activej.csp.ChannelSupplier
async, bindTo, filter, lenient, map, mapAsync, peek, streamTo, streamTo, toCollector, toList, transformWith, until, withEndOfStream, withExecutorMethods inherited from interface io.activej.common.initializer.WithInitializer
withInitializer
-
Field Details
-
DEFAULT_BUFFER_SIZE
public static final io.activej.common.MemSize DEFAULT_BUFFER_SIZE
-
-
Method Details
-
create
-
create
public static ChannelFileReader create(io.activej.async.file.AsyncFileService fileService, FileChannel channel) -
open
-
open
public static io.activej.promise.Promise<ChannelFileReader> open(Executor executor, Path path, OpenOption... openOptions) -
openBlocking
- Throws:
IOException
-
openBlocking
public static ChannelFileReader openBlocking(Executor executor, Path path, OpenOption... openOptions) throws IOException - Throws:
IOException
-
withBufferSize
-
withBufferSize
-
withOffset
-
withLimit
-
getPosition
public long getPosition() -
doGet
protected io.activej.promise.Promise<io.activej.bytebuf.ByteBuf> doGet()- Specified by:
doGetin classAbstractChannelSupplier<io.activej.bytebuf.ByteBuf>
-
onClosed
- Overrides:
onClosedin classio.activej.async.process.AbstractAsyncCloseable
-
toString
-