Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.compress.utils
Class ArchiveUtils

    java.lang.Object
      org.apache.commons.compress.utils.ArchiveUtils

    public class ArchiveUtils

extends Object

Generic Archive utilities

Method Summary
`static boolean` | `isEqual(byte[] buffer1, byte[] buffer2)` Compare byte buffers
`static boolean` | `isEqual(byte[] buffer1, byte[] buffer2, boolean ignoreTrailingNulls)` Compare byte buffers, optionally ignoring trailing nulls
`static boolean` | `isEqual(byte[] buffer1, int offset1, int length1, byte[] buffer2, int offset2, int length2)` Compare byte buffers
`static boolean` | `isEqual(byte[] buffer1, int offset1, int length1, byte[] buffer2, int offset2, int length2, boolean ignoreTrailingNulls)` Compare byte buffers, optionally ignoring trailing nulls
`static boolean` | `isEqualWithNull(byte[] buffer1, int offset1, int length1, byte[] buffer2, int offset2, int length2)` Compare byte buffers, ignoring trailing nulls
`static boolean` | `matchAsciiBuffer(String expected, byte[] buffer)` Check if buffer contents matches Ascii String.
`static boolean` | `matchAsciiBuffer(String expected, byte[] buffer, int offset, int length)` Check if buffer contents matches Ascii String.
`static byte[]` | `toAsciiBytes(String inputString)` Convert a string to Ascii bytes.
`static String` | `toAsciiString(byte[] inputBytes)` Convert an input byte array to a String using the ASCII character set.
`static String` | `toString(ArchiveEntry entry)` Generates a string containing the name, isDirectory setting and size of an entry.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### toString

    public static String toString(ArchiveEntry entry)

  Generates a string containing the name, isDirectory setting and size of an entry.

  For example:
  `- 2000 main.c`
  `d 100 testfiles`

  Returns:
    the representation of the entry

### matchAsciiBuffer

    public static boolean matchAsciiBuffer(String expected,
                                           byte[] buffer,
                                           int offset,
                                           int length)

  Check if buffer contents matches Ascii String.

  Parameters:
    `expected` -
    `buffer` -
    `offset` -
    `length` -
  Returns:
    `true` if buffer is the same as the expected string

### matchAsciiBuffer

    public static boolean matchAsciiBuffer(String expected,
                                           byte[] buffer)

  Check if buffer contents matches Ascii String.

  Parameters:
    `expected` -
    `buffer` -
  Returns:
    `true` if buffer is the same as the expected string

### toAsciiBytes

    public static byte[] toAsciiBytes(String inputString)

  Convert a string to Ascii bytes. Used for comparing "magic" strings which need to be independent of the default Locale.

  Parameters:
    `inputString` -
  Returns:
    the bytes

### toAsciiString

    public static String toAsciiString(byte[] inputBytes)

  Convert an input byte array to a String using the ASCII character set.

  Parameters:
    `inputBytes` -
  Returns:
    the bytes, interpreted as an Ascii string

### isEqual

    public static boolean isEqual(byte[] buffer1,
                                  int offset1,
                                  int length1,
                                  byte[] buffer2,
                                  int offset2,
                                  int length2,
                                  boolean ignoreTrailingNulls)

  Compare byte buffers, optionally ignoring trailing nulls

  Parameters:
    `buffer1` -
    `offset1` -
    `length1` -
    `buffer2` -
    `offset2` -
    `length2` -
    `ignoreTrailingNulls` -
  Returns:
    `true` if buffer1 and buffer2 have same contents, having regard to trailing nulls

### isEqual

    public static boolean isEqual(byte[] buffer1,
                                  int offset1,
                                  int length1,
                                  byte[] buffer2,
                                  int offset2,
                                  int length2)

  Compare byte buffers

  Parameters:
    `buffer1` -
    `offset1` -
    `length1` -
    `buffer2` -
    `offset2` -
    `length2` -
  Returns:
    `true` if buffer1 and buffer2 have same contents

### isEqual

    public static boolean isEqual(byte[] buffer1,
                                  byte[] buffer2)

  Compare byte buffers

  Parameters:
    `buffer1` -
    `buffer2` -
  Returns:
    `true` if buffer1 and buffer2 have same contents

### isEqual

    public static boolean isEqual(byte[] buffer1,
                                  byte[] buffer2,
                                  boolean ignoreTrailingNulls)

  Compare byte buffers, optionally ignoring trailing nulls

  Parameters:
    `buffer1` -
    `buffer2` -
    `ignoreTrailingNulls` -
  Returns:
    `true` if buffer1 and buffer2 have same contents

### isEqualWithNull

    public static boolean isEqualWithNull(byte[] buffer1,
                                          int offset1,
                                          int length1,
                                          byte[] buffer2,
                                          int offset2,
                                          int length2)

  Compare byte buffers, ignoring trailing nulls

  Parameters:
    `buffer1` -
    `offset1` -
    `length1` -
    `buffer2` -
    `offset2` -
    `length2` -
  Returns:
    `true` if buffer1 and buffer2 have same contents, having regard to trailing nulls

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2009 The Apache Software Foundation. All Rights Reserved.