de.smartics.util.io
Class DirectoryStreamHandler

java.lang.Object
  extended by de.smartics.util.io.DirectoryStreamHandler
All Implemented Interfaces:
StreamHandler

public final class DirectoryStreamHandler
     
     
extends Object
implements StreamHandler

Handles resources stored in a directory.


Constructor Summary
DirectoryStreamHandler(File rootDir)
          Default constructor.
 
Method Summary
 InputStream openToRead(String resourceId)
          Opens a stream to the given resource for reading.
 OutputStream openToWrite(String resourceId)
          Opens a stream to the given resource for writing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectoryStreamHandler

public DirectoryStreamHandler(File rootDir)
Default constructor.

Parameters:
rootDir - the root directory within which the resources are stored.
Method Detail

openToRead

public InputStream openToRead(String resourceId)
                       throws IOException
Opens a stream to the given resource for reading.

Specified by:
openToRead in interface StreamHandler
Parameters:
resourceId - the identifier of the resource that should be opened.
Returns:
the stream to the resource.
Throws:
IOException - on any problem opening the resource.

openToWrite

public OutputStream openToWrite(String resourceId)
                         throws IOException
Opens a stream to the given resource for writing.

Specified by:
openToWrite in interface StreamHandler
Parameters:
resourceId - the identifier of the resource that should be opened.
Returns:
the stream to the resource.
Throws:
IOException - on any problem opening the resource.


Copyright © 2011–2013 smartics. All rights reserved.