org.freecompany.redline.payload
Class CpioHeader
java.lang.Object
org.freecompany.redline.payload.CpioHeader
public class CpioHeader
- extends java.lang.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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
DEFAULT_FILE_PERMISSION
public static final int DEFAULT_FILE_PERMISSION
- See Also:
- Constant Field Values
DEFAULT_DIRECTORY_PERMISSION
public static final int DEFAULT_DIRECTORY_PERMISSION
- See Also:
- Constant Field Values
FIFO
public static final int FIFO
- See Also:
- Constant Field Values
CDEV
public static final int CDEV
- See Also:
- Constant Field Values
DIR
public static final int DIR
- See Also:
- Constant Field Values
BDEV
public static final int BDEV
- See Also:
- Constant Field Values
FILE
public static final int FILE
- See Also:
- Constant Field Values
SYMLINK
public static final int SYMLINK
- See Also:
- Constant Field Values
SOCKET
public static final int SOCKET
- See Also:
- Constant Field Values
CPIO_HEADER
protected static final int CPIO_HEADER
- See Also:
- Constant Field Values
MAGIC
protected static final java.lang.CharSequence MAGIC
TRAILER
protected static final java.lang.String TRAILER
- See Also:
- Constant Field Values
charset
protected java.nio.charset.Charset charset
inode
protected int inode
type
protected int type
permissions
protected int permissions
uid
protected int uid
uname
protected java.lang.String uname
gid
protected int gid
gname
protected java.lang.String gname
nlink
protected int nlink
mtime
protected long mtime
filesize
protected int filesize
devMinor
protected int devMinor
devMajor
protected int devMajor
rdevMinor
protected int rdevMinor
rdevMajor
protected int rdevMajor
checksum
protected int checksum
name
protected java.lang.String name
flags
protected int flags
CpioHeader
public CpioHeader()
CpioHeader
public CpioHeader(java.lang.String name)
CpioHeader
public CpioHeader(java.io.File file)
CpioHeader
public CpioHeader(java.lang.String name,
java.io.File file)
getType
public int getType()
getPermissions
public int getPermissions()
getRdevMajor
public int getRdevMajor()
getRdevMinor
public int getRdevMinor()
getDevMajor
public int getDevMajor()
getDevMinor
public int getDevMinor()
getMtime
public int getMtime()
getInode
public int getInode()
getName
public java.lang.String getName()
getFlags
public int getFlags()
getMode
public int getMode()
setPermissions
public void setPermissions(int permissions)
setType
public void setType(int type)
setFileSize
public void setFileSize(int filesize)
setMtime
public void setMtime(long mtime)
setInode
public void setInode(int inode)
setFlags
public void setFlags(int flags)
getUname
public java.lang.String getUname()
getGname
public java.lang.String getGname()
setUname
public void setUname(java.lang.String uname)
setGname
public void setGname(java.lang.String gname)
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.
setLast
public void setLast()
setName
public void setName(java.lang.String name)
getFileSize
public int getFileSize()
writeSix
protected java.nio.ByteBuffer writeSix(java.lang.CharSequence data)
writeEight
protected java.nio.ByteBuffer writeEight(int data)
readSix
protected java.lang.CharSequence readSix(java.nio.CharBuffer buffer)
readEight
protected int readEight(java.nio.CharBuffer buffer)
readChars
protected java.lang.CharSequence readChars(java.nio.CharBuffer buffer,
int length)
pad
protected java.lang.String pad(java.lang.CharSequence sequence,
int length)
skip
protected int skip(java.nio.channels.ReadableByteChannel channel,
int total)
throws java.io.IOException
- Throws:
java.io.IOException
skip
public int skip(java.nio.channels.WritableByteChannel channel,
int total)
throws java.io.IOException
- Throws:
java.io.IOException
read
public int read(java.nio.channels.ReadableByteChannel channel,
int total)
throws java.io.IOException
- Throws:
java.io.IOException
write
public int write(java.nio.channels.WritableByteChannel channel,
int total)
throws java.io.IOException
- Writed 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.
- Throws:
java.io.IOException
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object