Class SpongeAssetResource

  • All Implemented Interfaces:
    Resource

    public class SpongeAssetResource
    extends java.lang.Object
    implements Resource
    Resource implementation for Sponge Asset API.
    • Constructor Summary

      Constructors 
      Constructor Description
      SpongeAssetResource​(java.lang.String resourceName, org.spongepowered.api.asset.Asset asset)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] asBytes()  
      java.io.InputStream asInputStream()
      Get the resource as an InputStream.
      java.util.List<java.lang.String> asLines()
      Get the resource as lines.
      java.lang.String asString()
      Get the resource as a String with each line separated by CRLF newline characters \r\n.
      java.lang.String getResourceName()
      Get the name of this Resource.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SpongeAssetResource

        public SpongeAssetResource​(java.lang.String resourceName,
                                   org.spongepowered.api.asset.Asset asset)
    • Method Detail

      • getResourceName

        public java.lang.String getResourceName()
        Description copied from interface: Resource
        Get the name of this Resource.
        Specified by:
        getResourceName in interface Resource
        Returns:
        Relative file path given to PlanFiles.
      • asInputStream

        public java.io.InputStream asInputStream()
                                          throws java.io.IOException
        Description copied from interface: Resource
        Get the resource as an InputStream.
        Specified by:
        asInputStream in interface Resource
        Returns:
        InputStream of the resource, not closed automatically.
        Throws:
        java.io.IOException - If the resource is unavailable.
      • asLines

        public java.util.List<java.lang.String> asLines()
                                                 throws java.io.IOException
        Description copied from interface: Resource
        Get the resource as lines.
        Specified by:
        asLines in interface Resource
        Returns:
        Lines of the resource file.
        Throws:
        java.io.IOException - If the resource is unavailable.
      • asString

        public java.lang.String asString()
                                  throws java.io.IOException
        Description copied from interface: Resource
        Get the resource as a String with each line separated by CRLF newline characters \r\n.
        Specified by:
        asString in interface Resource
        Returns:
        Flat string with each line separated by \r\n.
        Throws:
        java.io.IOException - If the resource is unavailable.
      • asBytes

        public byte[] asBytes()
                       throws java.io.IOException
        Specified by:
        asBytes in interface Resource
        Throws:
        java.io.IOException