Interface Resource

All Known Implementing Classes:
ClassPathResource, FileResource, URLResource

public interface Resource
Resource descriptor that provides a strategy to get an InputStream to read bytes.
Author:
Middleware Services
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets an input stream around the resource.
  • Method Details

    • getInputStream

      InputStream getInputStream() throws IOException
      Gets an input stream around the resource. Callers of this method are responsible for resource cleanup; it should be sufficient to simply call InputStream.close() unless otherwise noted.

      Implementers should produce a new instance on every call to this method to provide for thread-safe usage patterns on a shared resource.

      Returns:
      Input stream around underlying resource, e.g. file, remote resource (URI), etc.
      Throws:
      IOException - On IO errors.