-
- All Superinterfaces:
java.lang.AutoCloseable,java.io.Closeable
- All Known Subinterfaces:
ScoredDualWriter<T>
- All Known Implementing Classes:
DataWriter,ManagedWriter,MappedWriter,QueuedWriter,ShardedWriter,ShardedWriter.GeneralShardedConsumer,ShardedWriter.PowerOf2ShardedConsumer,TextLineWriter
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ToFileWriter<T> extends java.io.CloseableEssentially just aConsumer, but assumed to be writing to a file or similar, and therefore extendsCloseable.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classToFileWriter.Builder<F>
-
Field Summary
Fields Modifier and Type Field Description static ToFileWriter<?>NULL
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidclose()static voidmkdirs(java.io.File dir)Make sure this directory exists, create if necessarystatic <F> ToFileWriter.Builder<F>newBuilder(F... file)static ToFileWriter.Builder<java.io.File>newBuilder(java.io.File file)static ToFileWriter.Builder<java.nio.file.Path>newBuilder(java.nio.file.Path file)static ToFileWriter.Builder<java.io.File>newBuilder(ShardedFile sharded)static java.io.OutputStreamoutput(java.io.File file)static <T extends java.io.Serializable>
voidserializeObjectToFile(T object, java.io.File file)voidwrite(T item)Write the item to the consumer.default voidwriteBatch(java.lang.Iterable<? extends T> batch)Write the batch (collection of items) to the consumer.
-
-
-
Field Detail
-
NULL
static final ToFileWriter<?> NULL
-
-
Method Detail
-
mkdirs
static void mkdirs(java.io.File dir)
Make sure this directory exists, create if necessary
-
newBuilder
static <F> ToFileWriter.Builder<F> newBuilder(F... file)
-
newBuilder
static ToFileWriter.Builder<java.io.File> newBuilder(java.io.File file)
-
newBuilder
static ToFileWriter.Builder<java.nio.file.Path> newBuilder(java.nio.file.Path file)
-
newBuilder
static ToFileWriter.Builder<java.io.File> newBuilder(ShardedFile sharded)
-
output
static java.io.OutputStream output(java.io.File file)
-
serializeObjectToFile
static <T extends java.io.Serializable> void serializeObjectToFile(T object, java.io.File file)
-
close
default void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
write
void write(T item)
Write the item to the consumer.- Parameters:
item- The item to be written
-
writeBatch
default void writeBatch(java.lang.Iterable<? extends T> batch)
Write the batch (collection of items) to the consumer.- Parameters:
batch- The batch to be written
-
-