Class FileResource

  • All Implemented Interfaces:
    Resource, java.lang.AutoCloseable

    public class FileResource
    extends java.lang.Object
    implements Resource
    A file resource.
    See Also:
    MemoryResource
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      java.io.File getFile()
      Returns the file object associated with this resource set.
      java.io.PrintWriter open()
      Opens this resource for writing.
      java.io.InputStream openForReading()
      Opens this resource for reading.
      java.io.OutputStream openForWriting()
      Opens this resource for writing.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getFile

        public java.io.File getFile()
        Returns the file object associated with this resource set.
        Returns:
        file object
      • open

        public java.io.PrintWriter open()
                                 throws java.io.IOException
        Description copied from interface: Resource
        Opens this resource for writing.
        Specified by:
        open in interface Resource
        Returns:
        print writer for writing to this resource.
        Throws:
        java.io.IOException - if an I/O related problem prevents this operation
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface Resource
        Throws:
        java.io.IOException
      • openForReading

        public java.io.InputStream openForReading()
                                           throws java.io.IOException
        Description copied from interface: Resource
        Opens this resource for reading.
        Specified by:
        openForReading in interface Resource
        Returns:
        input stream to read from this resource
        Throws:
        java.io.IOException - if an I/O related problem prevents this operation
      • openForWriting

        public java.io.OutputStream openForWriting()
                                            throws java.io.IOException
        Description copied from interface: Resource
        Opens this resource for writing.
        Specified by:
        openForWriting in interface Resource
        Returns:
        output stream to write from this resource
        Throws:
        java.io.IOException - if an I/O related problem prevents this operation