Module org.xbib.rpm

Class CpioHeader

java.lang.Object
org.xbib.rpm.payload.CpioHeader

public class CpioHeader extends Object
This class provides a means to read file content from the compressed CPIO stream that is the body of an RPM distributable. Iterative calls to to read header will result in a header description being returned which includes a count of how many bytes to read from the channel for the file content.
  • Field Details

  • Constructor Details

  • Method Details

    • normalizePath

      public static String normalizePath(String path)
    • difference

      public static int difference(int start, int boundary)
    • getType

      public int getType()
    • setType

      public void setType(int type)
    • getPermissions

      public int getPermissions()
    • setPermissions

      public void setPermissions(int permissions)
    • getRdevMajor

      public int getRdevMajor()
    • getRdevMinor

      public int getRdevMinor()
    • getDevMajor

      public int getDevMajor()
    • getDevMinor

      public int getDevMinor()
    • getMtime

      public int getMtime()
    • setMtime

      public void setMtime(long mtime)
    • getInode

      public int getInode()
    • setInode

      public void setInode(int inode)
    • setName

      public void setName(String name)
    • getName

      public String getName()
    • setFlags

      public void setFlags(int flags)
    • getFlags

      public int getFlags()
    • setVerifyFlags

      public void setVerifyFlags(int verifyFlags)
    • getVerifyFlags

      public int getVerifyFlags()
    • getMode

      public int getMode()
    • setUid

      public void setUid(int uid)
    • getUid

      public int getUid()
    • setGid

      public void setGid(int gid)
    • getGid

      public int getGid()
    • isLast

      public boolean isLast()
      Test to see if this is the last header, and is therefore the end of the archive. Uses the CPIO magic trailer value to denote the last header of the stream.
      Returns:
      true if last, false if not
    • setLast

      public void setLast()
    • getFileSize

      public int getFileSize()
    • setFileSize

      public void setFileSize(int filesize)
    • writeSix

      protected ByteBuffer writeSix(CharSequence data)
    • writeEight

      protected ByteBuffer writeEight(int data)
    • readSix

      protected CharSequence readSix(CharBuffer buffer)
    • readEight

      protected int readEight(CharBuffer buffer)
    • readChars

      protected CharSequence readChars(CharBuffer buffer, int length)
    • pad

      protected String pad(CharSequence sequence, int length)
    • skip

      protected int skip(ReadableByteChannel channel, int total) throws IOException
      Throws:
      IOException
    • skip

      public int skip(WritableByteChannel channel, int total) throws IOException
      Throws:
      IOException
    • read

      public int read(ReadableByteChannel channel, int total) throws IOException
      Throws:
      IOException
    • write

      public int write(WritableByteChannel channel, int total) throws IOException
      Write the content for the CPIO header, including the name immediately following. The name data is rounded to the nearest 2 byte boundary as CPIO requires by appending a null when needed.
      Parameters:
      channel - which channel to write on
      total - current size of header?
      Returns:
      total written and skipped
      Throws:
      IOException - there was an IO error
    • toString

      public String toString()
      Overrides:
      toString in class Object