org.apache.tika.parser.chm.core
Class ChmCommons

java.lang.Object
  extended by org.apache.tika.parser.chm.core.ChmCommons

public class ChmCommons
extends Object


Nested Class Summary
static class ChmCommons.EntryType
          Represents entry types: uncompressed, compressed
static class ChmCommons.IntelState
          Represents intel file states during decompression
static class ChmCommons.LzxState
          Represents lzx states: started decoding, not started decoding
 
Field Summary
static int ALIGNED_OFFSET
           
static int UNCOMPRESSED
           
static int UNDEFINED
          Represents lzx block types in order to decompress differently
static int VERBATIM
           
 
Method Summary
static void assertByteArrayNotNull(byte[] data)
           
static byte[] copyOfRange(byte[] original, int from, int to)
           
static byte[] getChmBlockSegment(byte[] data, ChmLzxcResetTable resetTable, int blockNumber, int lzxcBlockOffset, int lzxcBlockLength)
           
static String getLanguage(long langID)
          Returns textual representation of LangID
static int getWindowSize(int window)
          LZX supports window sizes of 2^15 (32Kb) through 2^21 (2Mb) Returns X, i.e 2^X
static boolean hasSkip(DirectoryListingEntry directoryListingEntry)
          Checks skippable patterns
static int indexOf(byte[] text, byte[] pattern)
          Searches some pattern in byte[]
static int indexOf(List<DirectoryListingEntry> list, String pattern)
          Searches for some pattern in the directory listing entry list
static int indexOfResetTableBlock(byte[] text, byte[] pattern)
          Returns an index of the reset table
static boolean isEmpty(String str)
           
static void main(String[] args)
           
static void reverse(byte[] array)
          Reverses the order of given array
static void writeFile(byte[][] buffer, String fileToBeSaved)
          Writes byte[][] to the file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNDEFINED

public static final int UNDEFINED
Represents lzx block types in order to decompress differently

See Also:
Constant Field Values

VERBATIM

public static final int VERBATIM
See Also:
Constant Field Values

ALIGNED_OFFSET

public static final int ALIGNED_OFFSET
See Also:
Constant Field Values

UNCOMPRESSED

public static final int UNCOMPRESSED
See Also:
Constant Field Values
Method Detail

assertByteArrayNotNull

public static void assertByteArrayNotNull(byte[] data)
                                   throws TikaException
Throws:
TikaException

getWindowSize

public static int getWindowSize(int window)
LZX supports window sizes of 2^15 (32Kb) through 2^21 (2Mb) Returns X, i.e 2^X

Parameters:
window - chmLzxControlData.getWindowSize()
Returns:
window size

getChmBlockSegment

public static byte[] getChmBlockSegment(byte[] data,
                                        ChmLzxcResetTable resetTable,
                                        int blockNumber,
                                        int lzxcBlockOffset,
                                        int lzxcBlockLength)
                                 throws TikaException
Throws:
TikaException

getLanguage

public static String getLanguage(long langID)
Returns textual representation of LangID

Parameters:
langID -
Returns:
language name

hasSkip

public static boolean hasSkip(DirectoryListingEntry directoryListingEntry)
Checks skippable patterns

Parameters:
directoryListingEntry -
Returns:
boolean

writeFile

public static void writeFile(byte[][] buffer,
                             String fileToBeSaved)
                      throws TikaException
Writes byte[][] to the file

Parameters:
buffer -
fileToBeSaved - file name
Throws:
TikaException

reverse

public static void reverse(byte[] array)
Reverses the order of given array

Parameters:
array -

indexOfResetTableBlock

public static final int indexOfResetTableBlock(byte[] text,
                                               byte[] pattern)
                                        throws ChmParsingException
Returns an index of the reset table

Parameters:
text -
pattern -
Returns:
index of the reset table
Throws:
ChmParsingException

indexOf

public static int indexOf(byte[] text,
                          byte[] pattern)
                   throws ChmParsingException
Searches some pattern in byte[]

Parameters:
text - byte[]
pattern - byte[]
Returns:
an index, if nothing found returns -1
Throws:
ChmParsingException

indexOf

public static int indexOf(List<DirectoryListingEntry> list,
                          String pattern)
Searches for some pattern in the directory listing entry list

Parameters:
list -
pattern -
Returns:
an index, if nothing found returns -1

copyOfRange

public static byte[] copyOfRange(byte[] original,
                                 int from,
                                 int to)

isEmpty

public static boolean isEmpty(String str)

main

public static void main(String[] args)
Parameters:
args -


Copyright © 2007-2012 The Apache Software Foundation. All Rights Reserved.