de.smartics.util.io
Class MemoryStreamHandler

Package class diagram package MemoryStreamHandler
java.lang.Object
  extended by de.smartics.util.io.MemoryStreamHandler
All Implemented Interfaces:
StreamHandler

@NotThreadSafe
public final class MemoryStreamHandler
     
     
extends Object
implements StreamHandler

Handles resources and stores them in-memory.


Constructor Summary
MemoryStreamHandler()
           
 
Method Summary
 byte[] getData(String resourceId)
          Allows direct access to the data stored.
 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

MemoryStreamHandler

public MemoryStreamHandler()
Method Detail

getData

public byte[] getData(String resourceId)
Allows direct access to the data stored.

Parameters:
resourceId - the identifier of the resource requested.
Returns:
the data from the store or null if there is no data for this key.

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 Kronseder & Reiner GmbH - smartics. All Rights Reserved.