|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.freecompany.redline.Util
public class Util
General utilities needed to read and write RPM files. Some of these utilities are available elsewhere but reproduced here to minimize runtime dependencies.
| Method Summary | |
|---|---|
static void |
check(byte expected,
byte actual)
Checks that two bytes are the same, while generating a formatted error message if they are not. |
static void |
check(int expected,
int actual)
Checks that two integers are the same, while generating a formatted error message if they are not. |
static int |
difference(int start,
int boundary)
|
static void |
dump(byte[] data)
|
static void |
dump(byte[] data,
Appendable out)
|
static void |
dump(ByteBuffer buf,
Appendable out)
|
static void |
dump(char[] data)
|
static void |
dump(char[] data,
Appendable out)
|
static void |
dump(CharSequence data)
|
static void |
empty(WritableByteChannel out,
ByteBuffer buffer)
Empties the contents of the given buffer into the writable channel provided. |
static ByteBuffer |
fill(ReadableByteChannel in,
ByteBuffer buffer)
Fills the provided buffer it with bytes from the provided channel. |
static ByteBuffer |
fill(ReadableByteChannel in,
int size)
Creates a new buffer and fills it with bytes from the provided channel. |
static String |
hex(byte[] data)
|
static String |
normalizePath(String path)
Converts path characters from their native format to the "forward-slash" format expected within RPM files. |
static InputStream |
openPayloadStream(Header header,
InputStream rpmIS)
Create the proper stream wrapper to handling the rpmIS payload section based on the payload compression header tag. |
static void |
pad(ByteBuffer buffer,
int boundary)
Pads the given buffer up to the indicated boundary. |
static int |
round(int start,
int boundary)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static String normalizePath(String path)
public static ByteBuffer fill(ReadableByteChannel in,
int size)
throws IOException
in - the channel to read fromsize - the number of bytes to read into a new buffer
IOException - if an IO error occurs
public static ByteBuffer fill(ReadableByteChannel in,
ByteBuffer buffer)
throws IOException
in - the channel to read frombuffer - the buffer to read into
IOException - if an IO error occurs
public static void empty(WritableByteChannel out,
ByteBuffer buffer)
throws IOException
out - the channel to write tobuffer - the buffer to write out to the channel
IOException - if an IO error occurs
public static void check(int expected,
int actual)
throws IOException
expected - the expected valueactual - the actual value
IOException - if the two values do not match
public static void check(byte expected,
byte actual)
throws IOException
expected - the expected valueactual - the actual value
IOException - if the two values do not match
public static int difference(int start,
int boundary)
public static int round(int start,
int boundary)
public static void pad(ByteBuffer buffer,
int boundary)
buffer - the buffer to pad zeros intoboundary - the boundary to which we need to padpublic static void dump(byte[] data)
public static void dump(byte[] data,
Appendable out)
public static void dump(char[] data)
public static void dump(CharSequence data)
public static void dump(char[] data,
Appendable out)
public static void dump(ByteBuffer buf,
Appendable out)
public static String hex(byte[] data)
public static InputStream openPayloadStream(Header header,
InputStream rpmIS)
throws IOException
header - rpmIS -
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||