|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.compress.archivers.tar.TarUtils
public class TarUtils
This class provides static utility methods to work with byte streams.
Method Summary | |
---|---|
static long |
computeCheckSum(byte[] buf)
Compute the checksum of a tar entry header. |
static int |
formatCheckSumOctalBytes(long value,
byte[] buf,
int offset,
int length)
Writes an octal value into a buffer. |
static int |
formatLongOctalBytes(long value,
byte[] buf,
int offset,
int length)
Write an octal long integer into a buffer. |
static int |
formatNameBytes(String name,
byte[] buf,
int offset,
int length)
Copy a name (StringBuffer) into a buffer. |
static int |
formatOctalBytes(long value,
byte[] buf,
int offset,
int length)
Write an octal integer into a buffer. |
static void |
formatUnsignedOctalString(long value,
byte[] buffer,
int offset,
int length)
Fill buffer with unsigned octal number, padded with leading zeroes. |
static String |
parseName(byte[] buffer,
int offset,
int length)
Parse an entry name from a buffer. |
static long |
parseOctal(byte[] buffer,
int offset,
int length)
Parse an octal string from a buffer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static long parseOctal(byte[] buffer, int offset, int length)
buffer
- The buffer from which to parse.offset
- The offset into the buffer from which to parse.length
- The maximum number of bytes to parse - must be at least 2 bytes.
IllegalArgumentException
- if the trailing space/NUL is missing or if a invalid byte is detected.public static String parseName(byte[] buffer, int offset, int length)
buffer
- The buffer from which to parse.offset
- The offset into the buffer from which to parse.length
- The maximum number of bytes to parse.
public static int formatNameBytes(String name, byte[] buf, int offset, int length)
name
- The header name from which to copy the characters.buf
- The buffer where the name is to be stored.offset
- The starting offset into the bufferlength
- The maximum number of header bytes to copy.
public static void formatUnsignedOctalString(long value, byte[] buffer, int offset, int length)
value
- number to convert to octal - treated as unsignedbuffer
- destination bufferoffset
- starting offset in bufferlength
- length of buffer to fill
IllegalArgumentException
- if the value will not fit in the bufferpublic static int formatOctalBytes(long value, byte[] buf, int offset, int length)
formatUnsignedOctalString(long, byte[], int, int)
to format
the value as an octal string with leading zeros.
The converted number is followed by space and NUL
value
- The value to writebuf
- The buffer to receive the outputoffset
- The starting offset into the bufferlength
- The size of the output buffer
IllegalArgumentException
- if the value (and trailer) will not fit in the bufferpublic static int formatLongOctalBytes(long value, byte[] buf, int offset, int length)
formatUnsignedOctalString(long, byte[], int, int)
to format
the value as an octal string with leading zeros.
The converted number is followed by a space.
value
- The value to write as octalbuf
- The destinationbuffer.offset
- The starting offset into the buffer.length
- The length of the buffer
IllegalArgumentException
- if the value (and trailer) will not fit in the bufferpublic static int formatCheckSumOctalBytes(long value, byte[] buf, int offset, int length)
formatUnsignedOctalString(long, byte[], int, int)
to format
the value as an octal string with leading zeros.
The converted number is followed by NUL and then space.
value
- The value to convertbuf
- The destination bufferoffset
- The starting offset into the buffer.length
- The size of the buffer.
IllegalArgumentException
- if the value (and trailer) will not fit in the bufferpublic static long computeCheckSum(byte[] buf)
buf
- The tar entry's header buffer.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |