Remote Systems
v6.4.1

com.ibm.etools.systems.core.archiveutils
Class VirtualChild

java.lang.Object
  extended bycom.ibm.etools.systems.core.archiveutils.VirtualChild

public final class VirtualChild
extends Object


Field Summary
protected  File _containingArchive
           
protected  File _extractedFile
           
protected  ISystemArchiveHandler _handler
           
 String fullName
           
 boolean isDirectory
           
 String name
           
 String path
           
 
Constructor Summary
VirtualChild(ISystemArchiveHandler handler)
          Constructs a new VirtualChild given a reference to its parent archive's handler, but does not populate any fields in the child.
VirtualChild(ISystemArchiveHandler handler, String fullVirtualName)
          Constructs a new VirtualChild given a reference to its parent archive's handler (handler), and immediately populates the name and path info for the VirtualChild given its fullVirtualName.
VirtualChild(String fullVirtualName, File containingArchive)
          Constructs a new VirtualChild given the name of its parent archive, and immediately populates the name and path info for the VirtualChild given its fullVirtualName.
 
Method Summary
 boolean exists()
           
 String getArchiveStandardName()
           
 String getComment()
           
 long getCompressedSize()
           
 String getCompressionMethod()
           
 double getCompressionRatio()
           
 File getContainingArchive()
           
 File getExtractedFile()
           
 boolean getExtractedFile(File destination)
          Gets the extracted file or directory represented by this VirtualChild from the archive, and replaces the object referred to by destination with that extracted file or directory.
 boolean getExtractedFile(File destination, String sourceEncoding, boolean isText)
          Gets the extracted file or directory represented by this VirtualChild from the archive, and replaces the object referred to by destination with that extracted file or directory.
 File getExtractedFile(String sourceEncoding, boolean isText)
           
 ISystemArchiveHandler getHandler()
           
 long getSize()
           
 long getTimeStamp()
           
 void renameTo(String newName)
          Renames this virtual child to newName.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fullName

public String fullName

name

public String name

path

public String path

isDirectory

public boolean isDirectory

_handler

protected ISystemArchiveHandler _handler

_extractedFile

protected File _extractedFile

_containingArchive

protected File _containingArchive
Constructor Detail

VirtualChild

public VirtualChild(ISystemArchiveHandler handler)
Constructs a new VirtualChild given a reference to its parent archive's handler, but does not populate any fields in the child. Clients must populate the fullName, name, path, and isDirectory fields.


VirtualChild

public VirtualChild(ISystemArchiveHandler handler,
                    String fullVirtualName)
Constructs a new VirtualChild given a reference to its parent archive's handler (handler), and immediately populates the name and path info for the VirtualChild given its fullVirtualName. Clients must still populate the isDirectory field.


VirtualChild

public VirtualChild(String fullVirtualName,
                    File containingArchive)
Constructs a new VirtualChild given the name of its parent archive, and immediately populates the name and path info for the VirtualChild given its fullVirtualName. Clients must still populate the isDirectory field. NOTE: This constructor is intended only to be used for creating NON-EXISTENT virtual children.

Method Detail

getHandler

public ISystemArchiveHandler getHandler()
Returns:
This VirtualChild's parent archive's Handler.

getTimeStamp

public long getTimeStamp()
Returns:
This VirtualChild's time stamp (retrieves the latest one from the archive).

getSize

public long getSize()
Returns:
This VirtualChild's uncompressed size (retrieves the latest one from the archive).

getComment

public String getComment()
Returns:
The comment associated with this VirtualChild.

getCompressedSize

public long getCompressedSize()
Returns:
The amount of space this VirtualChild takes up in the archive in compressed form.

getCompressionMethod

public String getCompressionMethod()
Returns:
The method used to compress this VirtualChild.

getCompressionRatio

public double getCompressionRatio()
Returns:
The actual minus compressed size of this VirtualChild, divided by the actual size.

getExtractedFile

public File getExtractedFile()
Returns:
The extracted file or directory represented by this VirtualChild from the archive. Note that the extracted file is cached after it is extracted once, but if the timestamps on the cached and archived files do not match, the cached file is erased, and reextracted from the archive.

getExtractedFile

public File getExtractedFile(String sourceEncoding,
                             boolean isText)
Returns:
The extracted file or directory represented by this VirtualChild from the archive. Assumes that the file has been encoded in the encoding specified. Note that the extracted file is cached after it is extracted once, but if the timestamps on the cached and archived files do not match, the cached file is erased, and reextracted from the archive.

getExtractedFile

public boolean getExtractedFile(File destination)
Gets the extracted file or directory represented by this VirtualChild from the archive, and replaces the object referred to by destination with that extracted file or directory. Note that the extracted file is cached after it is extracted once, but if the timestamps on the cached and archived files do not match, the cached file is erased, and reextracted from the archive. destination is always overwritten with either what is cached, or what is in the archive.

Returns:
true if and only if the extraction succeeded.

getExtractedFile

public boolean getExtractedFile(File destination,
                                String sourceEncoding,
                                boolean isText)
Gets the extracted file or directory represented by this VirtualChild from the archive, and replaces the object referred to by destination with that extracted file or directory. Note that the extracted file is cached after it is extracted once, but if the timestamps on the cached and archived files do not match, the cached file is erased, and reextracted from the archive. destination is always overwritten with either what is cached, or what is in the archive.

Returns:
true if and only if the extraction succeeded.

exists

public boolean exists()
Returns:
Whether or not this VirtualChild exists in the archive.

renameTo

public void renameTo(String newName)
Renames this virtual child to newName. WARNING!! This method does not change the underlying zip file, you must rename the entry in the zip file for subsequent calls to any of the getters to work.


getArchiveStandardName

public String getArchiveStandardName()
Returns:
The "standard" name for this VirtualChild, based on the handler type.

getContainingArchive

public File getContainingArchive()

Remote Systems
v6.4.1

Copyright © 2005 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.