com.myjavatools.lib
Class ZipInput

java.lang.Object
  extended by com.myjavatools.lib.ZipInput

public class ZipInput
extends java.lang.Object

Title: MyJavaTools: ZippedInput

Description: Extends ZipInputStream functionality. Good for Java 1.4 and up.

Copyright: This is public domain; The right of people to use, distribute, copy or improve the contents of the following may not be restricted.

Version:
1.4

Constructor Summary
ZipInput(byte[] data)
          initializes ZipInput with data
ZipInput(char[] data)
          initializes ZipInput with data
ZipInput(java.io.InputStream is)
          initializes ZipInput with InputStream
 
Method Summary
 byte[] getBytes()
          retrieves the contents of current ZipEntry data
 java.lang.String getChars(java.lang.String encoding)
          gets the contents of current ZipEntry data as characters
 java.util.zip.ZipEntry getEntry()
          gets current ZipEntry
 java.lang.String getEntryName()
          gets the name of current ZipEntry
 long getEntrySize()
          gets the size of current entry data
 long getEntryTime()
          gets timestamp of current zip entry
 boolean isEntryDirectory()
          checks whether current ZipEntry is a directory
 boolean next()
          moves to next ZipEntry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZipInput

public ZipInput(java.io.InputStream is)
initializes ZipInput with InputStream

Parameters:
is - InputStream the source of data

ZipInput

public ZipInput(byte[] data)
initializes ZipInput with data

Parameters:
data - byte[] the source data represented as bytes

ZipInput

public ZipInput(char[] data)
initializes ZipInput with data

Parameters:
data - char[] the source data represented as chars (a byte per char)
Method Detail

next

public boolean next()
             throws java.io.IOException
moves to next ZipEntry

Returns:
boolean true if there is a next entry; false otherwise
Throws:
java.io.IOException - when there are problems reading the input

getEntry

public java.util.zip.ZipEntry getEntry()
gets current ZipEntry

Returns:
ZipEntry current entry

getEntryName

public java.lang.String getEntryName()
gets the name of current ZipEntry

Returns:
String the entry name

getEntryTime

public long getEntryTime()
gets timestamp of current zip entry

Returns:
long the entry timestamp (ms since 1/1/70)

getEntrySize

public long getEntrySize()
gets the size of current entry data

Returns:
long the number of bytes in current entry data

isEntryDirectory

public boolean isEntryDirectory()
checks whether current ZipEntry is a directory

Returns:
boolean true if it is directory, false otherwise

getBytes

public byte[] getBytes()
                throws java.io.IOException
retrieves the contents of current ZipEntry data

Returns:
byte[] the contents of current entry data
Throws:
java.io.IOException - if could not read the data

getChars

public java.lang.String getChars(java.lang.String encoding)
                          throws java.io.IOException
gets the contents of current ZipEntry data as characters

Parameters:
encoding - String encoding to use
Returns:
String unzipped and decoded data
Throws:
java.io.IOException - when could not read the data