Package space.arim.dazzleconf.backend
Class StringRoot
java.lang.Object
space.arim.dazzleconf.backend.StringRoot
- All Implemented Interfaces:
DataRoot,ReadableRoot
Implementation of data root for a string
-
Nested Class Summary
Nested classes/interfaces inherited from interface space.arim.dazzleconf.backend.DataRoot
DataRoot.Operation<R,U> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks whether the data is known to exist.<R> RopenReader(@NonNull DataRoot.Operation<R, @NonNull Reader> operation) Opens a reader to the data<R> RopenWriter(@NonNull DataRoot.Operation<R, @NonNull Writer> operation) Opens a writer for the data@NonNull StringReads to a stringvoidwriteString(@NonNull String content) Writes to a string
-
Constructor Details
-
StringRoot
Creates from the given initial ccontent- Parameters:
content- the content
-
-
Method Details
-
dataExists
Description copied from interface:DataRootChecks whether the data is known to exist.- Specified by:
dataExistsin interfaceDataRoot- Returns:
- true if the data is known to be present, false if not present or if its existence cannot be determined
- Throws:
IOException- if checking for data existence failed
-
readString
Description copied from interface:ReadableRootReads to a string- Specified by:
readStringin interfaceReadableRoot- Returns:
- the read content
-
openReader
public <R> R openReader(@NonNull DataRoot.Operation<R, @NonNull Reader> operation) throws IOExceptionDescription copied from interface:ReadableRootOpens a reader to the data- Specified by:
openReaderin interfaceReadableRoot- Type Parameters:
R- the result type- Parameters:
operation- the operation- Returns:
- the operation result
- Throws:
IOException- upon failure to open
-
writeString
Description copied from interface:ReadableRootWrites to a string- Specified by:
writeStringin interfaceReadableRoot- Parameters:
content- the content to write
-
openWriter
public <R> R openWriter(@NonNull DataRoot.Operation<R, @NonNull Writer> operation) throws IOExceptionDescription copied from interface:ReadableRootOpens a writer for the data- Specified by:
openWriterin interfaceReadableRoot- Type Parameters:
R- the result type- Parameters:
operation- the operation- Returns:
- the operation result
- Throws:
IOException- upon failure to open
-