Class ResourceResource

java.lang.Object
org.openjdk.jmc.test.io.ResourceResource
All Implemented Interfaces:
IOResource

public class ResourceResource extends Object implements IOResource
An IO resource that is loaded from a Java resource.
  • Constructor Details

    • ResourceResource

      public ResourceResource(Class<?> clazz, String name)
      Parameters:
      clazz - use the class loader of this class to load the resource
      name - resource name
    • ResourceResource

      public ResourceResource(Class<?> clazz, String directory, String name)
      Parameters:
      clazz - use the class loader of this class to load the resource
      directory - resource directory name
      name - resource name relative to directory
  • Method Details

    • open

      public InputStream open() throws IOException
      Description copied from interface: IOResource
      Opens a stream that can be used to read the contents of the resource. Relies on caller to close the stream.
      Specified by:
      open in interface IOResource
      Returns:
      an InputStream
      Throws:
      IOException
    • close

      public void close()
      Description copied from interface: IOResource
      Closes whatever resources are not closed by caller to open.
      Specified by:
      close in interface IOResource
    • getName

      public String getName()
      Description copied from interface: IOResource
      The name of the resource.
      Specified by:
      getName in interface IOResource
      Returns:
      the name