Class ByteArrayResource

java.lang.Object
cloud.piranha.resource.ByteArrayResource
All Implemented Interfaces:
Resource

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

    Constructors
    Constructor Description
    ByteArrayResource​(java.lang.String location, byte[] bytes)
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    java.util.stream.Stream<java.lang.String> getAllLocations()
    Get all locations.
    byte[] getBytes()
    Get the byte-array.
    java.net.URL getResource​(java.lang.String location)
    Get the resource.
    java.io.InputStream getResourceAsStream​(java.lang.String location)
    Get the resource as a stream.

    Methods inherited from class java.lang.Object

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

    • ByteArrayResource

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

    • getAllLocations

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

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

      public java.net.URL getResource​(java.lang.String location)
      Get the resource.
      Specified by:
      getResource in interface Resource
      Parameters:
      location - the location.
      Returns:
      the URL, or null if not found.
    • getResourceAsStream

      public java.io.InputStream getResourceAsStream​(java.lang.String location)
      Get the resource as a stream.
      Specified by:
      getResourceAsStream in interface Resource
      Parameters:
      location - the location.
      Returns:
      the input stream.