Interface StringDataFormat
-
- All Superinterfaces:
DataFormat
,DefaultedRegistryValue
public interface StringDataFormat extends DataFormat
Represents aDataFormat
that reads and writes data from/to a string.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DataContainer
read(String input)
Creates a newDataContainer
from the contents of the givenString
.DataContainer
readFrom(Reader input)
Creates a newDataContainer
from the contents of the givenReader
.String
write(DataView data)
void
writeTo(Writer output, DataView data)
-
Methods inherited from interface org.spongepowered.api.data.persistence.DataFormat
readFrom, writeTo
-
Methods inherited from interface org.spongepowered.api.registry.DefaultedRegistryValue
asDefaultedReference, findKey, key
-
-
-
-
Method Detail
-
read
DataContainer read(String input) throws InvalidDataException, IOException
Creates a newDataContainer
from the contents of the givenString
.- Parameters:
input
- The string to parse- Returns:
- A data container representing the parsed contents of the string
- Throws:
InvalidDataException
- If the data in the string was not a supported formatIOException
- If there was an error reading from the string
-
readFrom
DataContainer readFrom(Reader input) throws InvalidDataException, IOException
Creates a newDataContainer
from the contents of the givenReader
.- Parameters:
input
- The reader- Returns:
- A data container representing the parsed contents of the reader
- Throws:
InvalidDataException
- If the data in the reader was not a supported formatIOException
- If there was an error reading from the reader
-
write
String write(DataView data) throws IOException
- Parameters:
data
- The DataView to write- Returns:
- The serialized data view
- Throws:
IOException
- If there was an error serializing the data
-
writeTo
void writeTo(Writer output, DataView data) throws IOException
- Parameters:
output
- The writer to write the data todata
- The DataView to write to the writer- Throws:
IOException
- If there was an error writing to the writer
-
-