Package org.nustaq.kontraktor.asyncio
Class AsyncFile
java.lang.Object
org.nustaq.kontraktor.asyncio.AsyncFile
Created by moelrue on 5/4/15.
-
Constructor Summary
ConstructorsConstructorDescriptioncreate an unitialized AsyncFile.create an async file and open for readAsyncFile(String file, OpenOption... options) create an async file and open with given options (e.g.AsyncFile(Path file, OpenOption... options) -
Method Summary
Modifier and TypeMethodDescriptionreturn a pseudo-blocking output stream.voidclose()longlength()voidopen(Path file, OpenOption... options) read(long position, int chunkSize, ByteBuffer target) write(long filePosition, ByteBuffer source)
-
Constructor Details
-
AsyncFile
public AsyncFile()create an unitialized AsyncFile. Use open to actually open a file -
AsyncFile
create an async file and open for read- Parameters:
file-- Throws:
IOException
-
AsyncFile
create an async file and open with given options (e.g. StandardOptions.READ or 'StandardOpenOption.WRITE, StandardOpenOption.CREATE')- Parameters:
file-- Throws:
IOException
-
AsyncFile
- Throws:
IOException
-
-
Method Details
-
asInputStream
-
asOutputStream
return a pseudo-blocking output stream. Note: due to limitations of the current await implementation (stack based), when writing many files concurrently from a single actor thread don't mix high latency file locations (e.g. remote file systems vs. local) with low latency ones. If this is required, fall back to the more basic read/write methods returning futures.- Returns:
-
open
- Throws:
IOException
-
length
public long length() -
readFully
-
read
-
write
-
close
public void close()
-