Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.jguild.jrpm.io
Class Header  view Header download Header.java

java.lang.Object
  extended bycom.jguild.jrpm.io.Header
Direct Known Subclasses:
RPMHeader, RPMSignature

public abstract class Header
extends java.lang.Object

This class represents the abstract definition of a header structur. It can be either a signature or a header. The tags of such a structure can be accessed by either their tag id or by their tag name. Also all available and all read tag names in this structure can be accessed.

Version:
$Id: Header.java,v 1.8 2003/10/20 16:32:11 mkuss Exp $

Field Summary
private static int HEADER_LENGTH
           
private  long indexDataSize
           
private  IndexEntry[] indexes
           
private  long indexNumber
           
private static org.apache.log4j.Logger logger
           
protected  long size
           
private  java.util.HashMap store
           
private  int version
           
 
Constructor Summary
Header(java.io.DataInputStream inputStream)
          Construct a header structure for the given input stream.
 
Method Summary
private static void check(boolean test)
          Asserts a boolean value and throws an exception if it is false
static java.lang.String[] getKnownTagNames()
          Read all known tag names for this header structure.
 long getSize()
          Get the size in bytes of this structure
 com.jguild.jrpm.io.datatype.DataTypeIf getTag(long tag)
          Get a tag by id as a long
 com.jguild.jrpm.io.datatype.DataTypeIf getTag(java.lang.Long tag)
          Get a tag by id as a Long
 com.jguild.jrpm.io.datatype.DataTypeIf getTag(java.lang.String tagname)
          Get a tag by name
abstract  long getTagIdForName(java.lang.String tagname)
          Read a tag with a given tag name.
 long[] getTagIds()
          Get all tag ids contained in this rpm file.
abstract  java.lang.String getTagNameForId(long tagid)
          Read a tag with a given tag id.
 java.lang.String[] getTagNames()
          Get all tag names contained in this rpm file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HEADER_LENGTH

private static final int HEADER_LENGTH
See Also:
Constant Field Values

logger

private static final org.apache.log4j.Logger logger

size

protected long size

store

private java.util.HashMap store

indexes

private IndexEntry[] indexes

version

private int version

indexDataSize

private long indexDataSize

indexNumber

private long indexNumber
Constructor Detail

Header

public Header(java.io.DataInputStream inputStream)
       throws java.io.IOException
Construct a header structure for the given input stream. The header structure of a signature or a header can be read and also the index entries containig the tags for this rpm section (signature or header). First a header is read consisting of the following fields:
 byte magic[3];      (3  byte)  (8e ad e8)
 int version;        (1  byte)
 byte reserved[4];   (4  byte)
 long num_index;     (4  byte)
 long num_data;      (4  byte)
 
Afterwareds the index entries are read and then the tags and the correspondig data entries are read.

Method Detail

getKnownTagNames

public static java.lang.String[] getKnownTagNames()
Read all known tag names for this header structure.


getSize

public long getSize()
Get the size in bytes of this structure


getTag

public com.jguild.jrpm.io.datatype.DataTypeIf getTag(java.lang.Long tag)
Get a tag by id as a Long


getTag

public com.jguild.jrpm.io.datatype.DataTypeIf getTag(long tag)
Get a tag by id as a long


getTag

public com.jguild.jrpm.io.datatype.DataTypeIf getTag(java.lang.String tagname)
Get a tag by name


getTagIdForName

public abstract long getTagIdForName(java.lang.String tagname)
Read a tag with a given tag name. The tag will be read out of the class defined in getTagEnum().


getTagIds

public long[] getTagIds()
Get all tag ids contained in this rpm file.


getTagNameForId

public abstract java.lang.String getTagNameForId(long tagid)
Read a tag with a given tag id. The tag will be read out of the class defined in getTagEnum().


getTagNames

public java.lang.String[] getTagNames()
Get all tag names contained in this rpm file.


check

private static final void check(boolean test)
                         throws java.io.IOException
Asserts a boolean value and throws an exception if it is false