Class ByteArrayResource

java.lang.Object
cloud.piranha.resource.ByteArrayResource
All Implemented Interfaces:
Resource
Direct Known Subclasses:
StringResource

public class ByteArrayResource extends Object implements Resource
The byte-array resource.
Author:
Manfred Riem ([email protected])
  • Constructor Details

    • ByteArrayResource

      public ByteArrayResource(String location, byte[] bytes)
      Constructor.
      Parameters:
      location - the location.
      bytes - the byte-array.
  • Method Details

    • getAllLocations

      public Stream<String> getAllLocations()
      Get all locations.
      Specified by:
      getAllLocations in interface Resource
      Returns:
      the locations.
    • getBytes

      public byte[] getBytes()
      Returns the byte-array.
      Returns:
      the byte-array
    • getResource

      public URL getResource(String url)
      Get the resource.
      Specified by:
      getResource in interface Resource
      Parameters:
      url - the url in string form.
      Returns:
      the URL, or null if not found.
    • getResourceAsStream

      public InputStream getResourceAsStream(String url)
      Get the resource as a stream.
      Specified by:
      getResourceAsStream in interface Resource
      Parameters:
      url - the location in URL form
      Returns:
      the input stream.
    • getResourceAsStreamByLocation

      public InputStream getResourceAsStreamByLocation(String location)
      Get the resource as stream by location.
      Parameters:
      location - the location.
      Returns:
      the input stream