- java.lang.Object
-
- kala.compress.archivers.dump.DumpArchiveUtil
-
final class DumpArchiveUtil extends java.lang.ObjectVarious utilities for dump archives.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateDumpArchiveUtil()Private constructor to prevent instantiation.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intcalculateChecksum(byte[] buffer)Calculate checksum for buffer.static intconvert16(byte[] buffer, int offset)Reads 2-byte integer from buffer.static intconvert32(byte[] buffer, int offset)Reads 4-byte integer from buffer.static longconvert64(byte[] buffer, int offset)Reads 8-byte integer from buffer.(package private) static java.lang.Stringdecode(java.nio.charset.Charset encoding, byte[] b, int offset, int len)Decodes a byte array to a string.static intgetIno(byte[] buffer)Gets the ino associated with this buffer.static booleanverify(byte[] buffer)Verifies that the buffer contains a tape segment header.
-
-
-
Method Detail
-
calculateChecksum
public static int calculateChecksum(byte[] buffer)
Calculate checksum for buffer.- Parameters:
buffer- buffer containing tape segment header- Returns:
- checksum
-
convert16
public static int convert16(byte[] buffer, int offset)Reads 2-byte integer from buffer.- Parameters:
buffer- The source buffer.offset- Where to start reading.- Returns:
- the 2-byte entry as an int.
-
convert32
public static int convert32(byte[] buffer, int offset)Reads 4-byte integer from buffer.- Parameters:
buffer- The source buffer.offset- Where to start reading.- Returns:
- the 4-byte entry as an int.
-
convert64
public static long convert64(byte[] buffer, int offset)Reads 8-byte integer from buffer.- Parameters:
buffer- The source buffer.offset- Where to start reading.- Returns:
- the 8-byte entry as a long.
-
decode
static java.lang.String decode(java.nio.charset.Charset encoding, byte[] b, int offset, int len) throws java.io.IOExceptionDecodes a byte array to a string.- Throws:
java.io.IOException
-
getIno
public static int getIno(byte[] buffer)
Gets the ino associated with this buffer.- Parameters:
buffer- The source buffer.- Returns:
- the ino associated with this buffer.
-
verify
public static boolean verify(byte[] buffer)
Verifies that the buffer contains a tape segment header.- Parameters:
buffer- The source buffer.- Returns:
- Whether the buffer contains a tape segment header.
-
-