RSE
Release 3.3

org.eclipse.rse.services.clientserver.archiveutils
Class VirtualChild

java.lang.Object
  extended by org.eclipse.rse.services.clientserver.archiveutils.VirtualChild

public final class VirtualChild
extends Object

A simple structure for passing information about virtual files and folders.


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()
           
 void getExtractedFile(File destination, ISystemOperationMonitor archiveOperationMonitor)
          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.
 void getExtractedFile(File destination, String sourceEncoding, boolean isText, ISystemOperationMonitor archiveOperationMonitor)
          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, ISystemOperationMonitor archiveOperationMonitor)
           
 ISystemArchiveHandler getHandler()
           
 long getSize()
           
 long getTimeStamp()
           
 void renameTo(String newName)
          Renames this virtual child to newName.
 void setComment(String value)
           
 void setCompressedSize(long value)
           
 void setCompressionMethod(String value)
           
 void setSize(long value)
           
 void setTimeStamp(long value)
           
 
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).

setTimeStamp

public void setTimeStamp(long value)
Parameters:
value - the time stamp value
Since:
3.0

getSize

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

setSize

public void setSize(long value)
Parameters:
value - the size value
Since:
3.0

getComment

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

setComment

public void setComment(String value)
Parameters:
value - the comment value
Since:
3.0

getCompressedSize

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

setCompressedSize

public void setCompressedSize(long value)
Parameters:
value - the compressedSize value
Since:
3.0

getCompressionMethod

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

setCompressionMethod

public void setCompressionMethod(String value)
Parameters:
value - the compression method value
Since:
3.0

getCompressionRatio

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

getExtractedFile

public File getExtractedFile()
                      throws SystemMessageException
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.
Throws:
SystemMessageException

getExtractedFile

public File getExtractedFile(String sourceEncoding,
                             boolean isText,
                             ISystemOperationMonitor archiveOperationMonitor)
                      throws SystemMessageException
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 re-extracted from the archive.
Throws:
SystemMessageException
Since:
3.0 throws SystemMessageException

getExtractedFile

public void getExtractedFile(File destination,
                             ISystemOperationMonitor archiveOperationMonitor)
                      throws SystemMessageException
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 re-extracted from the archive. destination is always overwritten with either what is cached, or what is in the archive.

Throws:
SystemMessageException - in case of an error
Since:
3.0 throws SystemMessageException

getExtractedFile

public void getExtractedFile(File destination,
                             String sourceEncoding,
                             boolean isText,
                             ISystemOperationMonitor archiveOperationMonitor)
                      throws SystemMessageException
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.

Throws:
SystemMessageException - in case of an error
Since:
3.0 throws SystemMessageException

exists

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

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()

RSE
Release 3.3

Copyright (c) IBM Corporation and others 2000, 2011. All Rights Reserved.