Class StringCachingResource

java.lang.Object
com.djrapitops.plan.storage.file.StringCachingResource
All Implemented Interfaces:
Resource

public class StringCachingResource extends Object implements Resource
Resource decorator to cache result of asString method call in ResourceCache.
  • Method Details

    • getResourceName

      public 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 InputStream asInputStream() throws 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:
      IOException - If the resource is unavailable.
    • asLines

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

      public String asString() throws 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:
      IOException - If the resource is unavailable.
    • asBytes

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