Class TarUtils
- java.lang.Object
-
- org.apache.commons.compress.archivers.tar.TarUtils
-
public class TarUtils extends java.lang.Object
This class provides static utility methods to work with byte streams.- Version:
- $Revision: 155439 $ $Date: 2008-07-05 20:15:52 -0400 (Sat, 05 Jul 2008) $
- Author:
- Timothy Gerard Endres, Stefano Mazzocchi
-
-
Constructor Summary
Constructors Constructor Description TarUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
computeCheckSum(byte[] buffer)
Compute the checksum of a tar entry header.static int
getCheckSumOctalBytes(long value, byte[] buf, int offset, int length)
Parse the checksum octal integer from a header buffer.static int
getLongOctalBytes(long value, byte[] buf, int offset, int length)
Parse an octal long integer from a header buffer.static int
getNameBytes(java.lang.StringBuffer name, byte[] buffer, int offset, int length)
Determine the number of bytes in an entry name.static int
getOctalBytes(long value, byte[] buffer, int offset, int length)
Parse an octal integer from a header buffer.static java.lang.StringBuffer
parseName(byte[] header, int offset, int length)
Parse an entry name from a header buffer.static long
parseOctal(byte[] header, int offset, int length)
Parse an octal string from a header buffer.
-
-
-
Method Detail
-
getCheckSumOctalBytes
public static int getCheckSumOctalBytes(long value, byte[] buf, int offset, int length)
Parse the checksum octal integer from a header buffer.- Parameters:
offset
- The offset into the buffer from which to parse.length
- The number of header bytes to parse.value
- Description of Parameterbuf
- Description of Parameter- Returns:
- The integer value of the entry's checksum.
-
getLongOctalBytes
public static int getLongOctalBytes(long value, byte[] buf, int offset, int length)
Parse an octal long integer from a header buffer.- Parameters:
offset
- The offset into the buffer from which to parse.length
- The number of header bytes to parse.value
- Description of Parameterbuf
- Description of Parameter- Returns:
- The long value of the octal bytes.
-
getNameBytes
public static int getNameBytes(java.lang.StringBuffer name, byte[] buffer, int offset, int length)
Determine the number of bytes in an entry name.- Parameters:
offset
- The offset into the buffer from which to parse.length
- The number of header bytes to parse.name
- Description of Parameterbuffer
- Description of Parameter- Returns:
- The number of bytes in a header's entry name.
-
getOctalBytes
public static int getOctalBytes(long value, byte[] buffer, int offset, int length)
Parse an octal integer from a header buffer.- Parameters:
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.
-
computeCheckSum
public static long computeCheckSum(byte[] buffer)
Compute the checksum of a tar entry header.- Parameters:
buffer
- The tar entry's header buffer.- Returns:
- The computed checksum.
-
parseName
public static java.lang.StringBuffer parseName(byte[] header, int offset, int length)
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.
-
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.
-
-