Class ChmCommons
- java.lang.Object
- 
- org.apache.tika.parser.microsoft.chm.ChmCommons
 
- 
 public class ChmCommons extends Object 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classChmCommons.EntryTypeRepresents entry types: uncompressed, compressedstatic classChmCommons.IntelStateRepresents intel file states during decompressionstatic classChmCommons.LzxStateRepresents lzx states: started decoding, not started decoding
 - 
Field SummaryFields Modifier and Type Field Description static intALIGNED_OFFSETstatic intUNCOMPRESSEDstatic intUNDEFINEDRepresents lzx block types in order to decompress differentlystatic intVERBATIM
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static voidassertByteArrayNotNull(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 StringgetLanguage(long langID)Returns textual representation of LangIDstatic intgetWindowSize(int window)LZX supports window sizes of 2^15 (32Kb) through 2^21 (2Mb) Returns X, i.e 2^Xstatic booleanhasSkip(DirectoryListingEntry directoryListingEntry)Checks skippable patternsstatic intindexOfDataSpaceStorageElement(byte[] text, byte[] pattern)Searches some pattern in byte[]static intindexOfDataSpaceStorageElement(List<DirectoryListingEntry> list, String pattern)Searches for some pattern in the directory listing entry list This requires that the entry name start with "::DataSpaceStorage" See TIKA-4204static intindexOfResetTableBlock(byte[] text, byte[] pattern)Returns an index of the reset tablestatic booleanisEmpty(String str)static voidreverse(byte[] array)Reverses the order of given arraystatic voidwriteFile(byte[][] buffer, String fileToBeSaved)Writes byte[][] to the file
 
- 
- 
- 
Field Detail- 
UNDEFINEDpublic static final int UNDEFINED Represents lzx block types in order to decompress differently- See Also:
- Constant Field Values
 
 - 
VERBATIMpublic static final int VERBATIM - See Also:
- Constant Field Values
 
 - 
ALIGNED_OFFSETpublic static final int ALIGNED_OFFSET - See Also:
- Constant Field Values
 
 - 
UNCOMPRESSEDpublic static final int UNCOMPRESSED - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
assertByteArrayNotNullpublic static void assertByteArrayNotNull(byte[] data) throws TikaException- Throws:
- TikaException
 
 - 
getWindowSizepublic 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
 
 - 
getChmBlockSegmentpublic static byte[] getChmBlockSegment(byte[] data, ChmLzxcResetTable resetTable, int blockNumber, int lzxcBlockOffset, int lzxcBlockLength) throws TikaException- Throws:
- TikaException
 
 - 
getLanguagepublic static String getLanguage(long langID) Returns textual representation of LangID- Parameters:
- langID-
- Returns:
- language name
 
 - 
hasSkippublic static boolean hasSkip(DirectoryListingEntry directoryListingEntry) Checks skippable patterns- Parameters:
- directoryListingEntry-
- Returns:
- boolean
 
 - 
writeFilepublic static void writeFile(byte[][] buffer, String fileToBeSaved) throws TikaExceptionWrites byte[][] to the file- Parameters:
- buffer-
- fileToBeSaved- file name
- Throws:
- TikaException
 
 - 
reversepublic static void reverse(byte[] array) Reverses the order of given array- Parameters:
- array-
 
 - 
indexOfResetTableBlockpublic static final int indexOfResetTableBlock(byte[] text, byte[] pattern) throws ChmParsingExceptionReturns an index of the reset table- Parameters:
- text-
- pattern-
- Returns:
- index of the reset table
- Throws:
- ChmParsingException
 
 - 
indexOfDataSpaceStorageElementpublic static int indexOfDataSpaceStorageElement(byte[] text, byte[] pattern) throws ChmParsingExceptionSearches some pattern in byte[]- Parameters:
- text- byte[]
- pattern- byte[]
- Returns:
- an index, if nothing found returns -1
- Throws:
- ChmParsingException
 
 - 
indexOfDataSpaceStorageElementpublic static int indexOfDataSpaceStorageElement(List<DirectoryListingEntry> list, String pattern) Searches for some pattern in the directory listing entry list This requires that the entry name start with "::DataSpaceStorage" See TIKA-4204- Parameters:
- list-
- pattern-
- Returns:
- an index, if nothing found returns -1
 
 - 
copyOfRangepublic static byte[] copyOfRange(byte[] original, int from, int to) throws TikaException- Throws:
- TikaException
 
 - 
isEmptypublic static boolean isEmpty(String str) 
 
- 
 
-