RSE
Release 3.3

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

java.lang.Object
  extended by org.eclipse.rse.services.clientserver.archiveutils.TarEntry
All Implemented Interfaces:
Cloneable

public class TarEntry
extends Object
implements Cloneable

This class represents a tar file entry.

Since:
3.0

Field Summary
 byte[] chksum
           
 byte[] devmajor
           
 byte[] devminor
           
 byte[] gid
           
 byte[] gname
           
 byte[] linkname
           
 byte[] magic
           
 byte[] mode
           
 byte[] mtime
           
 byte[] name
           
 byte[] prefix
           
 byte[] size
           
 byte typeflag
           
 byte[] uid
           
 byte[] uname
           
 byte[] version
           
 
Constructor Summary
TarEntry(String name)
          Creates a new tar entry with the specified name.
 
Method Summary
 void calculateChecksum()
          Calculates the checksum of the entry.
 Object clone()
           
 long getChecksum()
          Gets the checksum.
 String getDevMajor()
          Gets the major device number in octal.
 String getDevMinor()
          Gets the minor device number in octal.
 String getGID()
          Gets the gid in octal.
 String getGroupName()
          Gets the group name.
 String getLinkName()
          Gets the link name.
 String getMagic()
          Returns whether the archive was output in the P1003 archive format.
 String getMode()
          Gets the mode in octal.
 long getModificationTime()
          Gets the modification time, in milliseconds since 00:00:00 GMT, January 1, 1970.
 String getName()
          Gets the name.
 String getPrefix()
          Gets the prefix in octal.
 long getSize()
          Gets the size in bytes.
 char getTypeFlag()
          Gets the type of file archived.
 String getUID()
          Gets the uid in octal.
 String getUserName()
          Gets the user name.
 String getVersion()
          Gets the version in octal.
 boolean isDirectory()
          Returns whether the entry represents a directory.
 void setModificationTime(long modTime)
          Sets the modification time.
 void setName(String fileName)
          Sets the name of the tar entry.
 void setSize(long fileSize)
          Sets the file size in bytes.
 void setUserMode(boolean canRead, boolean canWrite, boolean canExecute)
          Sets the user mod.
 void setUserName(String userName)
          Sets the user name of the tar entry.
 void writeFields(OutputStream outStream)
          Write the fields to the given output stream.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

public byte[] name

mode

public byte[] mode

uid

public byte[] uid

gid

public byte[] gid

size

public byte[] size

mtime

public byte[] mtime

chksum

public byte[] chksum

typeflag

public byte typeflag

linkname

public byte[] linkname

magic

public byte[] magic

version

public byte[] version

uname

public byte[] uname

gname

public byte[] gname

devmajor

public byte[] devmajor

devminor

public byte[] devminor

prefix

public byte[] prefix
Constructor Detail

TarEntry

public TarEntry(String name)
Creates a new tar entry with the specified name. Use the setter methods to populate the other fields of the entry.

Parameters:
name - the name of the tar entry.
Throws:
NullPointerException - if the name is null.
IllegalArgumentException - if the length of the name is greater that
Method Detail

setName

public void setName(String fileName)
Sets the name of the tar entry.

Parameters:
fileName - the name for the tar entry.
Throws:
NullPointerException - if the name is null.

getName

public String getName()
Gets the name.

Returns:
the name.

setUserMode

public void setUserMode(boolean canRead,
                        boolean canWrite,
                        boolean canExecute)
Sets the user mod.

Parameters:
canRead - true if the user has read permission, false otherwise.
canWrite - true if the user has write permission, false otherwise.
canExecute - true if the user has execute permission, false otherwise.

getMode

public String getMode()
Gets the mode in octal.

Returns:
the mode.

getUID

public String getUID()
Gets the uid in octal.

Returns:
the uid.

getGID

public String getGID()
Gets the gid in octal.

Returns:
the gid.

setSize

public void setSize(long fileSize)
Sets the file size in bytes.

Parameters:
fileSize - the file size.

getSize

public long getSize()
Gets the size in bytes.

Returns:
the size.

setModificationTime

public void setModificationTime(long modTime)
Sets the modification time.

Parameters:
modTime - the modification time, in milliseconds since 00:00:00 GMT, January 1, 1970.

getModificationTime

public long getModificationTime()
Gets the modification time, in milliseconds since 00:00:00 GMT, January 1, 1970.

Returns:
the modification time.

getChecksum

public long getChecksum()
Gets the checksum.

Returns:
the checksum.

getTypeFlag

public char getTypeFlag()
Gets the type of file archived.

Returns:
the type flag.

getLinkName

public String getLinkName()
Gets the link name.

Returns:
the link name.

getMagic

public String getMagic()
Returns whether the archive was output in the P1003 archive format. This is not used.

Returns:
the magic field.

getVersion

public String getVersion()
Gets the version in octal.

Returns:
the version.

setUserName

public void setUserName(String userName)
Sets the user name of the tar entry.

Parameters:
userName - the user name for the tar entry.
Throws:
NullPointerException - if the user name is null.

getUserName

public String getUserName()
Gets the user name.

Returns:
the user name.

getGroupName

public String getGroupName()
Gets the group name.

Returns:
the group name.

getDevMajor

public String getDevMajor()
Gets the major device number in octal.

Returns:
the major device number.

getDevMinor

public String getDevMinor()
Gets the minor device number in octal.

Returns:
the minor device number.

getPrefix

public String getPrefix()
Gets the prefix in octal.

Returns:
the prefix.

isDirectory

public boolean isDirectory()
Returns whether the entry represents a directory.

Returns:
true if the entry represents a directory, false otherwise.

writeFields

public void writeFields(OutputStream outStream)
                 throws IOException
Write the fields to the given output stream.

Parameters:
outStream - the output stream to write to.
Throws:
IOException

calculateChecksum

public void calculateChecksum()
Calculates the checksum of the entry.


clone

public Object clone()
             throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException
See Also:
Object.clone()

RSE
Release 3.3

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