patterntesting.runtime.util
Class ArchivEntry

Package class diagram package ArchivEntry
java.lang.Object
  extended by patterntesting.runtime.util.ArchivEntry

public class ArchivEntry
extends Object

Unfortunately we can't extends URI because this is a final class. So now it is more or less implemented as URI wrapper and is intended for the use with zip and jar files to describe an entry inside an archive.
Historically some parts of this class were developed for a log browser for Log4J. The facility to read (compressed) tar files (using org.apache.commons.compress.tar.*) were removed because we use it here only for zip and jar files.

Since:
20.09.2007
Version:
$Revision: 1.7 $
Author:
oliver (ob@aosd.de)

Constructor Summary
protected ArchivEntry(File file)
          Instantiates a new archiv entry.
  ArchivEntry(String s)
          Instantiates a new archiv entry.
  ArchivEntry(String scheme, File archive, String entry)
          Instantiates a new archiv entry.
  ArchivEntry(URI uri)
          Instantiates a new archiv entry.
  ArchivEntry(URL url)
          Instantiates a new archiv entry.
 
Method Summary
 boolean equals(ArchivEntry other)
          If two entries have a different size or not the same byte code they are considered as not equal.
 boolean equals(Object other)
          Equals.
 byte[] getBytes()
          Gets the bytes.
 String getEntry()
          Gets the entry.
 File getFile()
          Gets the file.
 long getSize()
          Gets the size.
 ZipEntry getZipEntry()
          Gets the zip entry.
 ZipFile getZipFile()
          Gets the zip file.
 int hashCode()
          Hash code.
 boolean isFile()
          Checks if is file.
 String toString()
          To string.
 URI toURI()
          To uri.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArchivEntry

protected ArchivEntry(File file)
Instantiates a new archiv entry.

Parameters:
file - the file

ArchivEntry

public ArchivEntry(String s)
Instantiates a new archiv entry.

Parameters:
s - the s

ArchivEntry

public ArchivEntry(URI uri)
Instantiates a new archiv entry.

Parameters:
uri - the uri

ArchivEntry

public ArchivEntry(URL url)
Instantiates a new archiv entry.

Parameters:
url - the url

ArchivEntry

public ArchivEntry(String scheme,
                   File archive,
                   String entry)
            throws URISyntaxException
Instantiates a new archiv entry.

Parameters:
scheme - the scheme
archive - the archive
entry - the entry
Throws:
URISyntaxException - the URI syntax exception
Method Detail

toURI

public URI toURI()
To uri.

Returns:
the uRI

isFile

public boolean isFile()
Checks if is file.

Returns:
true, if is file

getFile

public File getFile()
Gets the file.

Returns:
the file

getZipFile

public ZipFile getZipFile()
                   throws IOException
Gets the zip file.

Returns:
the zip file
Throws:
IOException - Signals that an I/O exception has occurred.

getEntry

public String getEntry()
Gets the entry.

Returns:
the entry

getZipEntry

public ZipEntry getZipEntry()
Gets the zip entry.

Returns:
the zip entry

getSize

public long getSize()
             throws IOException
Gets the size.

Returns:
the size
Throws:
IOException - Signals that an I/O exception has occurred.

getBytes

public byte[] getBytes()
                throws IOException
Gets the bytes.

Returns:
the bytes
Throws:
IOException - Signals that an I/O exception has occurred.

equals

public boolean equals(Object other)
Equals.

Overrides:
equals in class Object
Parameters:
other - the other
Returns:
true, if successful
See Also:
Object.equals(java.lang.Object)

equals

public boolean equals(ArchivEntry other)
If two entries have a different size or not the same byte code they are considered as not equal.

Parameters:
other - the other
Returns:
true if they have the same size and the same byte code.

hashCode

public int hashCode()
Hash code.

Overrides:
hashCode in class Object
Returns:
the hash code
See Also:
Object.hashCode()

toString

public String toString()
To string.

Overrides:
toString in class Object
Returns:
the string
See Also:
Object.toString()


Copyright © 2002–2014 PatternTesting Team. All rights reserved.