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

Quick Search    Search Deep

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

java.lang.Object
  extended bycom.jguild.jrpm.io.RPMFile

public class RPMFile
extends java.lang.Object

This class allows IO access to an RPM file.

Version:
$Id: RPMFile.java,v 1.19 2003/11/19 13:46:14 ymenager Exp $

Field Summary
private  java.io.File archiveFile
           
private  long archiveOffset
           
private  RPMHeader header
           
private  RPMLead lead
           
private  int localePosition
           
private static org.apache.log4j.Logger logger
           
private  PayloadArchive payload
           
private  RPMSignature signature
           
 
Constructor Summary
RPMFile()
          Creates a new empty RPMFile object.
RPMFile(java.io.File fh)
          Creates a new RPMFile object out of a file.
RPMFile(java.io.InputStream rpmInputStream)
          Creates a new RPMFile object out of a input stream.
 
Method Summary
 void close()
          Release locked resources.
 void extract(java.io.File basedir)
          Extract this RPM file.
 RPMHeader getHeader()
          Get the header section of this rpm file.
static java.lang.String[] getKnownTagNames()
          Get all known tags of this rpm file.
 RPMLead getLead()
          Get the lead section of this rpm file
 java.lang.String[] getLocales()
          Return all known locales that are supported by this RPM file.
 PayloadArchive getPayloadArchive()
          Get the archive as a CPIO Archive.
 RPMSignature getSignature()
          Get the signature section of this rpm file
 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
 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.
 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.
 void readFromStream(java.io.InputStream rpmInputStream)
          Read informations of a rpm file out of an input stream.
 void setLocale(int pos)
          Set the locale as int for all I18N strings that are returned by getTag().
 void setLocale(java.lang.String locale)
          Set the locale as string for all I18N strings that are returned by getTag().
 void setPayloadArchive(PayloadArchive payloadArchive)
           
 void write(java.io.OutputStream rpmOutputStream)
          Write this rpm file to an output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final org.apache.log4j.Logger logger

header

private RPMHeader header

lead

private RPMLead lead

signature

private RPMSignature signature

localePosition

private int localePosition

payload

private PayloadArchive payload

archiveOffset

private long archiveOffset

archiveFile

private java.io.File archiveFile
Constructor Detail

RPMFile

public RPMFile()
Creates a new empty RPMFile object.


RPMFile

public RPMFile(java.io.File fh)
        throws java.io.IOException
Creates a new RPMFile object out of a file.


RPMFile

public RPMFile(java.io.InputStream rpmInputStream)
        throws java.io.IOException
Creates a new RPMFile object out of a input stream.

Method Detail

getHeader

public RPMHeader getHeader()
Get the header section of this rpm file.


getKnownTagNames

public static java.lang.String[] getKnownTagNames()
Get all known tags of this rpm file. This is equivalent to the --querytags option in rpm.


getLead

public RPMLead getLead()
Get the lead section of this rpm file


setLocale

public void setLocale(int pos)
Set the locale as int for all I18N strings that are returned by getTag(). The position has to correspond with the same position in the array returned by getLocales().


setLocale

public void setLocale(java.lang.String locale)
Set the locale as string for all I18N strings that are returned by getTag(). The string must match with a string returned by getLocales().


getLocales

public java.lang.String[] getLocales()
Return all known locales that are supported by this RPM file. The array is read out of the RPM file with the tag "HEADERI18NTABLE". The RPM has one entry for all I18N strings defined by this tag.


setPayloadArchive

public void setPayloadArchive(PayloadArchive payloadArchive)

getPayloadArchive

public PayloadArchive getPayloadArchive()
                                 throws java.io.IOException
Get the archive as a CPIO Archive.


getSignature

public RPMSignature getSignature()
Get the signature section of this rpm file


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 long getTagIdForName(java.lang.String tagname)
Read a tag with a given tag name.


getTagIds

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


getTagNameForId

public java.lang.String getTagNameForId(long tagid)
Read a tag with a given tag id.


getTagNames

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


readFromStream

public void readFromStream(java.io.InputStream rpmInputStream)
                    throws java.io.IOException
Read informations of a rpm file out of an input stream.


close

public void close()
Release locked resources.


write

public void write(java.io.OutputStream rpmOutputStream)
Write this rpm file to an output stream.


extract

public void extract(java.io.File basedir)
             throws java.io.IOException
Extract this RPM file.