Interface StringDataFormat
- All Superinterfaces:
DataFormat
,DefaultedRegistryValue
Represents a
DataFormat
that reads and writes data from/to a string.-
Method Summary
Modifier and TypeMethodDescriptionCreates a newDataContainer
from the contents of the givenString
.Creates a newDataContainer
from the contents of the givenReader
.void
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 Details
-
read
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
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
- Parameters:
data
- The DataView to write- Returns:
- The serialized data view
- Throws:
IOException
- If there was an error serializing the data
-
writeTo
- 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
-