Class TarUtils
java.lang.Object
org.apache.activemq.console.command.store.tar.TarUtils
This class provides static utility methods to work with byte streams.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longcomputeCheckSum(byte[] buf) Compute the checksum of a tar entry header.static intgetCheckSumOctalBytes(long value, byte[] buf, int offset, int length) Parse the checksum octal integer from a header buffer.static intgetLongOctalBytes(long value, byte[] buf, int offset, int length) Parse an octal long integer from a header buffer.static intgetNameBytes(StringBuffer name, byte[] buf, int offset, int length) Determine the number of bytes in an entry name.static intgetOctalBytes(long value, byte[] buf, int offset, int length) Parse an octal integer from a header buffer.static StringBufferparseName(byte[] header, int offset, int length) Parse an entry name from a header buffer.static longparseOctal(byte[] header, int offset, int length) Parse an octal string from a header buffer.
-
Constructor Details
-
TarUtils
public TarUtils()
-
-
Method Details
-
parseOctal
public static long parseOctal(byte[] header, int offset, int length) Parse an octal string from a header buffer. This is used for the file permission mode value.- Parameters:
header- The header buffer from which to parse.offset- The offset into the buffer from which to parse.length- The number of header bytes to parse.- Returns:
- The long value of the octal string.
-
parseName
Parse an entry name from a header buffer.- Parameters:
header- The header buffer from which to parse.offset- The offset into the buffer from which to parse.length- The number of header bytes to parse.- Returns:
- The header's entry name.
-
getNameBytes
Determine the number of bytes in an entry name.- Parameters:
name- The header name from which to parse.buf- The buffer from which to parse.offset- The offset into the buffer from which to parse.length- The number of header bytes to parse.- Returns:
- The number of bytes in a header's entry name.
-
getOctalBytes
public static int getOctalBytes(long value, byte[] buf, int offset, int length) Parse an octal integer from a header buffer.- Parameters:
value- The header valuebuf- The buffer from which to parse.offset- The offset into the buffer from which to parse.length- The number of header bytes to parse.- Returns:
- The integer value of the octal bytes.
-
getLongOctalBytes
public static int getLongOctalBytes(long value, byte[] buf, int offset, int length) Parse an octal long integer from a header buffer.- Parameters:
value- The header valuebuf- The buffer from which to parse.offset- The offset into the buffer from which to parse.length- The number of header bytes to parse.- Returns:
- The long value of the octal bytes.
-
getCheckSumOctalBytes
public static int getCheckSumOctalBytes(long value, byte[] buf, int offset, int length) Parse the checksum octal integer from a header buffer.- Parameters:
value- The header valuebuf- The buffer from which to parse.offset- The offset into the buffer from which to parse.length- The number of header bytes to parse.- Returns:
- The integer value of the entry's checksum.
-
computeCheckSum
public static long computeCheckSum(byte[] buf) Compute the checksum of a tar entry header.- Parameters:
buf- The tar entry's header buffer.- Returns:
- The computed checksum.
-