org.apache.sling.scripting.jsp.jasper
Interface IOProvider


public interface IOProvider

The IOProvider is an interface to provide more control of sending output from JSP Java and Class generation phases as well as cleaning up in case of problems.


Method Summary
 boolean delete(java.lang.String fileName)
          Remove a generated output.
 java.lang.ClassLoader getClassLoader()
          Return the class loader to use
 java.io.InputStream getInputStream(java.lang.String fileName)
          Returns an input stream to a file which has been written through a stream obtained form getOutputStream(String)
 java.io.OutputStream getOutputStream(java.lang.String fileName)
           
 long lastModified(java.lang.String fileName)
          Returns the last modification time stamp of the resource (generally a file) at the given absolute location.
 boolean mkdirs(java.lang.String path)
          Creates folders (folder like) structures, such that a container for data is available at the given path.
 boolean rename(java.lang.String oldFileName, java.lang.String newFileName)
          Renames the the file from the old file to the new file name
 

Method Detail

getOutputStream

java.io.OutputStream getOutputStream(java.lang.String fileName)
                                     throws java.io.IOException
Parameters:
fileName - The absolute path name of the destination into which to write the output. The semantics of this path depends on the implementation of this interface.
Returns:
an OutputStream into which to write the generated output.
Throws:
java.io.IOException - If the output stream cannot be created for the file.

getInputStream

java.io.InputStream getInputStream(java.lang.String fileName)
                                   throws java.io.FileNotFoundException,
                                          java.io.IOException
Returns an input stream to a file which has been written through a stream obtained form getOutputStream(String)

Parameters:
fileName - The absolute path name of the source from which to read the input. The semantics of this path depends on the implementation of this interface.
Returns:
an InputStream from which to read the input.
Throws:
java.io.FileNotFoundException - If the file cannot be found
java.io.IOException - If any other error occurs.

delete

boolean delete(java.lang.String fileName)
Remove a generated output.

Parameters:
fileName - The absolute path name of the item to remove. The semantics of this path depends on the implementation of this interface.
Returns:
true if the item could be removed, otherwise false is removed.

rename

boolean rename(java.lang.String oldFileName,
               java.lang.String newFileName)
Renames the the file from the old file to the new file name

Parameters:
oldFileName -
newFileName -
Returns:
true if renaming succeeded

mkdirs

boolean mkdirs(java.lang.String path)
Creates folders (folder like) structures, such that a container for data is available at the given path.

In the case of a OS Filesystem implementation, this method would be implemented by means of new java.io.File(path).mkdirs().

Parameters:
path - The absolute path of the folder to create.
Returns:
true if and only if the folder was created, along with all necessary parent directories; false otherwise.

lastModified

long lastModified(java.lang.String fileName)
Returns the last modification time stamp of the resource (generally a file) at the given absolute location.

Parameters:
fileName - The absolute path to the file whose last modification time stamp is to be returned.
Returns:
The last modification time stamp of the resource in milliseconds since the epoch or -1 if no resource exists at the given location.

getClassLoader

java.lang.ClassLoader getClassLoader()
Return the class loader to use



Copyright © 2007-2012 The Apache Software Foundation. All Rights Reserved.