public class FileIO
extends java.lang.Object
| Constructor and Description |
|---|
FileIO() |
| Modifier and Type | Method and Description |
|---|---|
static Source<ByteString,scala.concurrent.Future<IOResult>> |
fromFile(java.io.File f,
int chunkSize)
Deprecated.
Use `fromPath` instead. Since 2.4.5.
|
static Source<ByteString,scala.concurrent.Future<IOResult>> |
fromPath(java.nio.file.Path f,
int chunkSize)
Creates a Source from a files contents.
|
static Source<ByteString,scala.concurrent.Future<IOResult>> |
fromPath(java.nio.file.Path f,
int chunkSize,
long startPosition)
Creates a Source from a files contents.
|
static Sink<ByteString,scala.concurrent.Future<IOResult>> |
toFile(java.io.File f,
scala.collection.immutable.Set<java.nio.file.OpenOption> options)
Deprecated.
Use `toPath` instead. Since 2.4.5.
|
static Sink<ByteString,scala.concurrent.Future<IOResult>> |
toPath(java.nio.file.Path f,
scala.collection.immutable.Set<java.nio.file.OpenOption> options)
Creates a Sink which writes incoming
ByteString elements to the given file path. |
static Sink<ByteString,scala.concurrent.Future<IOResult>> |
toPath(java.nio.file.Path f,
scala.collection.immutable.Set<java.nio.file.OpenOption> options,
long startPosition)
Creates a Sink which writes incoming
ByteString elements to the given file path. |
public static Source<ByteString,scala.concurrent.Future<IOResult>> fromFile(java.io.File f, int chunkSize)
chunkSize sized ByteString elements,
except the final element, which will be up to chunkSize in size.
You can configure the default dispatcher for this Source by changing the akka.stream.blocking-io-dispatcher or
set it for a given Source by using ActorAttributes.
It materializes a Future of IOResult containing the number of bytes read from the source file upon completion,
and a possible exception if IO operation was not completed successfully.
f - the file to read fromchunkSize - the size of each read operation, defaults to 8192public static Source<ByteString,scala.concurrent.Future<IOResult>> fromPath(java.nio.file.Path f, int chunkSize)
chunkSize sized ByteString elements,
except the final element, which will be up to chunkSize in size.
You can configure the default dispatcher for this Source by changing the akka.stream.blocking-io-dispatcher or
set it for a given Source by using ActorAttributes.
It materializes a Future of IOResult containing the number of bytes read from the source file upon completion,
and a possible exception if IO operation was not completed successfully.
f - the file path to read fromchunkSize - the size of each read operation, defaults to 8192public static Source<ByteString,scala.concurrent.Future<IOResult>> fromPath(java.nio.file.Path f, int chunkSize, long startPosition)
chunkSize sized ByteString elements,
except the final element, which will be up to chunkSize in size.
You can configure the default dispatcher for this Source by changing the akka.stream.blocking-io-dispatcher or
set it for a given Source by using ActorAttributes.
It materializes a Future of IOResult containing the number of bytes read from the source file upon completion,
and a possible exception if IO operation was not completed successfully.
f - the file path to read fromchunkSize - the size of each read operation, defaults to 8192startPosition - the start position to read frompublic static Sink<ByteString,scala.concurrent.Future<IOResult>> toFile(java.io.File f, scala.collection.immutable.Set<java.nio.file.OpenOption> options)
ByteString elements to the given file. Overwrites existing files
by truncating their contents as default.
Materializes a Future of IOResult that will be completed with the size of the file (in bytes) at the streams completion,
and a possible exception if IO operation was not completed successfully.
This source is backed by an Actor which will use the dedicated akka.stream.blocking-io-dispatcher,
unless configured otherwise by using ActorAttributes.
f - the file to write tooptions - File open options, see StandardOpenOption, defaults to Set(WRITE, TRUNCATE_EXISTING, CREATE)public static Sink<ByteString,scala.concurrent.Future<IOResult>> toPath(java.nio.file.Path f, scala.collection.immutable.Set<java.nio.file.OpenOption> options)
ByteString elements to the given file path. Overwrites existing files
by truncating their contents as default.
Materializes a Future of IOResult that will be completed with the size of the file (in bytes) at the streams completion,
and a possible exception if IO operation was not completed successfully.
This source is backed by an Actor which will use the dedicated akka.stream.blocking-io-dispatcher,
unless configured otherwise by using ActorAttributes.
f - the file path to write tooptions - File open options, see StandardOpenOption, defaults to Set(WRITE, TRUNCATE_EXISTING, CREATE)public static Sink<ByteString,scala.concurrent.Future<IOResult>> toPath(java.nio.file.Path f, scala.collection.immutable.Set<java.nio.file.OpenOption> options, long startPosition)
ByteString elements to the given file path. Overwrites existing files
by truncating their contents as default.
Materializes a Future of IOResult that will be completed with the size of the file (in bytes) at the streams completion,
and a possible exception if IO operation was not completed successfully.
This source is backed by an Actor which will use the dedicated akka.stream.blocking-io-dispatcher,
unless configured otherwise by using ActorAttributes.
f - the file path to write tooptions - File open options, see StandardOpenOption, defaults to Set(WRITE, CREATE)startPosition - the start position to write to