Class FileResource

java.lang.Object
org.cryptacular.io.FileResource
All Implemented Interfaces:
Resource

public class FileResource extends Object implements Resource
Resource that produces a buffered FileInputStream from a file.
Author:
Middleware Services
  • Constructor Details

    • FileResource

      public FileResource(File file)
      Creates a new file resource.
      Parameters:
      file - Non-null file.
  • Method Details

    • getInputStream

      public InputStream getInputStream() throws IOException
      Description copied from interface: Resource
      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.

      Specified by:
      getInputStream in interface Resource
      Returns:
      Input stream around underlying resource, e.g. file, remote resource (URI), etc.
      Throws:
      IOException - On IO errors.
    • toString

      public String toString()
      Overrides:
      toString in class Object