com.bluemarsh.jswat
Class ZipSource

java.lang.Object
  |
  +--com.bluemarsh.jswat.ZipSource
All Implemented Interfaces:
SourceSource

public class ZipSource
extends java.lang.Object
implements SourceSource

Class ZipSource is a concrete implementation of SourceSource in which the source is backed by a java.util.zip.ZipFile instance.

Author:
Nathan Fiedler

Field Summary
protected  java.io.File entryAsFile
          Used for getting just the name of the zip entry.
protected  java.util.zip.ZipEntry zipEntry
          Entry in the zip file representing the source.
protected  java.util.zip.ZipFile zipFile
          Archive file from which the source eminates.
 
Constructor Summary
ZipSource(java.util.zip.ZipFile file, java.util.zip.ZipEntry entry)
          Constructs a ZipSource from the given file and entry.
 
Method Summary
 java.io.InputStream getInputStream()
          Get the input stream for reading the source code.
 java.lang.String getName()
          Returns just the name of the source file, not including the path to the file, if any.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

zipFile

protected java.util.zip.ZipFile zipFile
Archive file from which the source eminates.

zipEntry

protected java.util.zip.ZipEntry zipEntry
Entry in the zip file representing the source.

entryAsFile

protected java.io.File entryAsFile
Used for getting just the name of the zip entry.
Constructor Detail

ZipSource

public ZipSource(java.util.zip.ZipFile file,
                 java.util.zip.ZipEntry entry)
Constructs a ZipSource from the given file and entry.
Parameters:
file - zip file.
entry - entry within the zip file.
Throws:
java.lang.IllegalArgumentException - if arguments are null.
Method Detail

getName

public java.lang.String getName()
Returns just the name of the source file, not including the path to the file, if any.
Specified by:
getName in interface SourceSource
Returns:
name of source.

getInputStream

public java.io.InputStream getInputStream()
Get the input stream for reading the source code.
Specified by:
getInputStream in interface SourceSource
Returns:
input stream to the source code, or null if error.