Interface FileFormat<N extends Node<?>>
- Type Parameters:
N
- a type of root node
- All Known Implementing Classes:
BinaryFormat
,GsonFormat
,JacksonFormat
,PropertiesFormat
,YamlFormat
public interface FileFormat<N extends Node<?>>
An interface for loading/saving
Node
s from/to files.-
Method Summary
Modifier and TypeMethodDescriptiondefault N
load
(@NotNull InputStream input) Loads a node from aInputStream
.Loads a node from aReader
.default N
Loads a node from a file.default void
save
(N node, @NotNull OutputStream output) Saves a node to aOutputStream
.void
Saves a node to aWriter
.default void
Saves a node to a file.
-
Method Details
-
load
Loads a node from aReader
.- Parameters:
reader
- aReader
to 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
- aInputStream
to 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
- aWriter
to 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
- aOutputStream
to write a node- Throws:
IOException
- if I/O error occurred
-