de.unido.ls5.eti.client
Class ByteArrayVirtualFile

java.lang.Object
  extended by de.unido.ls5.eti.client.ByteArrayVirtualFile
All Implemented Interfaces:
VirtualFile

public class ByteArrayVirtualFile
extends Object
implements VirtualFile

This is an implementation of VirtualFile that uses a byte array to store the data.

Rating red

Constructor Summary
ByteArrayVirtualFile(InputStream inputStream, String filename)
          Initializes this VirtualFile by copying the data from inputStream and storing it in an internal byte array.
 
Method Summary
 String getFilename()
          As the implementation is independent from real files, it must have a file name that is handled separately.
 InputStream getInputStream()
          Retrieves an input stream to read the internal byte array
 String toString()
          Produces a debug String that contains the virtual filename and the number of bytes stored.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ByteArrayVirtualFile

public ByteArrayVirtualFile(InputStream inputStream,
                            String filename)
                     throws IOException
Initializes this VirtualFile by copying the data from inputStream and storing it in an internal byte array.

Parameters:
inputStream - the input stream where the data is read from
filename - the virtual filename
Throws:
IOException - if something during copying of the data goes wrong.
Method Detail

getInputStream

public InputStream getInputStream()
Retrieves an input stream to read the internal byte array

Specified by:
getInputStream in interface VirtualFile
Returns:
the input streamto read the internal byte array

getFilename

public String getFilename()
Description copied from interface: VirtualFile
As the implementation is independent from real files, it must have a file name that is handled separately. This filename is used by jETI to identify the file's name within the jETI-file-context.

Specified by:
getFilename in interface VirtualFile
Returns:
The name of this VirtualFile
See Also:
VirtualFile.getFilename()

toString

public String toString()
Produces a debug String that contains the virtual filename and the number of bytes stored.

Specified by:
toString in interface VirtualFile
Overrides:
toString in class Object
Returns:
the debug string