public interface BinaryStorageBase
Modifier and Type | Field and Description |
---|---|
static BinaryStorageBase |
INSTANCE
Default instance of
BinaryStorageBase . |
static org.slf4j.Logger |
LOG
Logger for default implementations.
|
Modifier and Type | Method and Description |
---|---|
default boolean |
contains(String id)
Checks if binary exists within storage.
|
default void |
createDirectories(Path... directories)
Create directories on file system.
|
default Function<File,byte[]> |
fileReader()
Constructs reader function that reads content from a file as array of bytes.
|
default BiConsumer<File,byte[]> |
fileWriter()
Constructs writer function that writes array of bytes to a file.
|
default BiConsumer<Writer,File> |
flushWriter()
Flushes writer to the file.
|
default BiFunction<File,String,String> |
folderFileReader()
Reads content from file in directory as a String.
|
default Optional<InputStream> |
get(File file)
Get the binary stored with the given id as an option.
|
default BiFunction<File,String,Writer> |
getWriter()
Constructs a function that returns writer for a given
outputFile
possibly using charsetName when non-null. |
boolean |
put(String id,
InputStream stream)
Store the given binary referenced by the given id.
|
static final org.slf4j.Logger LOG
static final BinaryStorageBase INSTANCE
BinaryStorageBase
.boolean put(String id, InputStream stream)
id
- The given id.stream
- The given binary to store.default Optional<InputStream> get(File file)
file
- The given File.default boolean contains(String id)
id
- The given id.default BiFunction<File,String,String> folderFileReader()
default Function<File,byte[]> fileReader()
File
and returns byte[]
array.default BiConsumer<File,byte[]> fileWriter()
File
as a destination parameter
and byte[]
array that should be written to the destination.default BiFunction<File,String,Writer> getWriter()
outputFile
possibly using charsetName
when non-null.Lambda arguments:
File
were the writer should writes to;String
encoding. When non-null used when writing to the output file;Writer
an initialized writer.default BiConsumer<Writer,File> flushWriter()
Writer
with content
and target File
.default void createDirectories(Path... directories) throws IOException
directories
- paths to create.IOException
- creating is failed.Copyright (c) 2014-2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries