Package dev.siroshun.configapi.core.file
Interface FileFormat<N extends Node<?>>
- Type Parameters:
N- a type of root node
- All Known Implementing Classes:
BinaryFormat,GsonArrayFormat,GsonFormat,JacksonFormat,PropertiesFormat,YamlFormat
public interface FileFormat<N extends Node<?>>
An interface for loading/saving
Nodes from/to files.-
Method Summary
Modifier and TypeMethodDescriptiondefault Nload(@NotNull InputStream input) Loads a node from aInputStream.Loads a node from aReader.default NLoads a node from a file.default voidsave(N node, @NotNull OutputStream output) Saves a node to aOutputStream.voidSaves a node to aWriter.default voidSaves a node to a file.
-
Method Details
-
load
Loads a node from aReader.- Parameters:
reader- aReaderto load a node- Returns:
- a loaded
Node(FileFormat) - Throws:
IOException- if I/O error occurred
-
load
Loads a node from a file.- Parameters:
filepath- a filepath to load a node- Returns:
- a loaded
Node(FileFormat) - Throws:
IOException- if I/O error occurred
-
load
Loads a node from aInputStream.- Parameters:
input- aInputStreamto load a node- Returns:
- a loaded
Node(FileFormat) - Throws:
IOException- if I/O error occurred
-
save
Saves a node to aWriter.- Parameters:
node- a rootNode(FileFormat) to savewriter- aWriterto write a node- Throws:
IOException- if I/O error occurred
-
save
Saves a node to a file.- Parameters:
node- a rootNode(FileFormat) to savefilepath- a filepath to write a node- Throws:
IOException- if I/O error occurred
-
save
Saves a node to aOutputStream.- Parameters:
node- a rootNode(FileFormat) to saveoutput- aOutputStreamto write a node- Throws:
IOException- if I/O error occurred
-