Interface DataFormat
-
- All Superinterfaces:
DefaultedRegistryValue
- All Known Subinterfaces:
StringDataFormat
@CatalogedBy(DataFormats.class) public interface DataFormat extends DefaultedRegistryValue
Represents a parser for a particular file format allowing reading and writing a DataContainer to/from a stream of the specific format.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DataContainerreadFrom(java.io.InputStream input)Creates a newDataContainerfrom the contents of the givenInputStream.voidwriteTo(java.io.OutputStream output, DataView data)-
Methods inherited from interface org.spongepowered.api.registry.DefaultedRegistryValue
asDefaultedReference, findKey, key
-
-
-
-
Method Detail
-
readFrom
DataContainer readFrom(java.io.InputStream input) throws InvalidDataFormatException, java.io.IOException
Creates a newDataContainerfrom the contents of the givenInputStream.- Parameters:
input- The input stream- Returns:
- A data container representing the contents of the input stream
- Throws:
InvalidDataFormatException- If the data in the stream was not a supported formatjava.io.IOException- If there was an error reading from the stream
-
writeTo
void writeTo(java.io.OutputStream output, DataView data) throws java.io.IOException- Parameters:
output- The output stream to write the data todata- The DataView to write to the stream- Throws:
java.io.IOException- If there was an error writing to the stream
-
-