public class Util extends Object
| Modifier and Type | Method and Description |
|---|---|
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 int |
getTempArraySize(int totalSize) |
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) |
public static int getTempArraySize(int totalSize)
public static String normalizePath(String path)
path - the path to the filepublic static ByteBuffer fill(ReadableByteChannel in, int size) throws IOException
in - the channel to read fromsize - the number of bytes to read into a new bufferIOException - if an IO error occurspublic static ByteBuffer fill(ReadableByteChannel in, ByteBuffer buffer) throws IOException
in - the channel to read frombuffer - the buffer to read intoIOException - if an IO error occurspublic static void empty(WritableByteChannel out, ByteBuffer buffer) throws IOException
out - the channel to write tobuffer - the buffer to write out to the channelIOException - if an IO error occurspublic static void check(int expected,
int actual)
throws IOException
expected - the expected valueactual - the actual valueIOException - if the two values do not matchpublic static void check(byte expected,
byte actual)
throws IOException
expected - the expected valueactual - the actual valueIOException - if the two values do not matchpublic 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 - the headerrpmIS - raw input stream of the rpmIOException - an IO error occurredCopyright © 2021. All Rights Reserved.