public interface FileContents
Modifier and Type | Method | Description |
---|---|---|
Provider<byte[]> |
getAsBytes() |
Gets a provider of the entire file contents as a single byte array.
|
Provider<java.lang.String> |
getAsText() |
Gets a provider of the entire file contents as a single String.
|
Provider<java.lang.String> getAsText()
The file is read only once and only when the value is requested for the first time.
The returned provider won't have a value, i.e., Provider.isPresent()
will return false
when:
FileContents
is connected to a Provider
<
RegularFile
>
with no value;
When the underlying file exists but reading it fails, the ensuing exception is permanently propagated to callers of
Provider.get()
, Provider.getOrElse(T)
, Provider.getOrNull()
and Provider.isPresent()
.
Provider<byte[]> getAsBytes()
The file is read only once and only when the value is requested for the first time.
The returned provider won't have a value, i.e., Provider.isPresent()
will return false
when:
FileContents
is connected to a Provider
<
RegularFile
>
with no value;
When the underlying file exists but reading it fails, the ensuing exception is permanently propagated to callers of
Provider.get()
, Provider.getOrElse(T)
, Provider.getOrNull()
and Provider.isPresent()
.