Interface StringDataFormat
-
- All Superinterfaces:
DataFormat,DefaultedRegistryValue
public interface StringDataFormat extends DataFormat
Represents aDataFormatthat reads and writes data from/to a string.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DataContainerread(java.lang.String input)Creates a newDataContainerfrom the contents of the givenString.DataContainerreadFrom(java.io.Reader input)Creates a newDataContainerfrom the contents of the givenReader.java.lang.Stringwrite(DataView data)voidwriteTo(java.io.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(java.lang.String input) throws InvalidDataException, java.io.IOException
Creates a newDataContainerfrom 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 formatjava.io.IOException- If there was an error reading from the string
-
readFrom
DataContainer readFrom(java.io.Reader input) throws InvalidDataException, java.io.IOException
Creates a newDataContainerfrom 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 formatjava.io.IOException- If there was an error reading from the reader
-
write
java.lang.String write(DataView data) throws java.io.IOException
- Parameters:
data- The DataView to write- Returns:
- The serialized data view
- Throws:
java.io.IOException- If there was an error serializing the data
-
writeTo
void writeTo(java.io.Writer output, DataView data) throws java.io.IOException- Parameters:
output- The writer to write the data todata- The DataView to write to the writer- Throws:
java.io.IOException- If there was an error writing to the writer
-
-