You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ju...@apache.org on 2011/09/18 12:39:12 UTC

svn commit: r1172242 [8/9] - in /tika/trunk: tika-app/src/test/java/org/apache/tika/cli/ tika-core/src/main/java/org/apache/tika/detect/ tika-core/src/main/java/org/apache/tika/extractor/ tika-core/src/main/java/org/apache/tika/fork/ tika-core/src/main...

Modified: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/chm/lzx/ChmLzxState.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/chm/lzx/ChmLzxState.java?rev=1172242&r1=1172241&r2=1172242&view=diff
==============================================================================
--- tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/chm/lzx/ChmLzxState.java (original)
+++ tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/chm/lzx/ChmLzxState.java Sun Sep 18 10:39:08 2011
@@ -1,311 +1,311 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tika.parser.chm.lzx;
-
-import java.util.concurrent.CancellationException;
-
-import org.apache.tika.exception.TikaException;
-import org.apache.tika.parser.chm.core.ChmCommons;
-import org.apache.tika.parser.chm.core.ChmConstants;
-import org.apache.tika.parser.chm.core.ChmCommons.IntelState;
-import org.apache.tika.parser.chm.core.ChmCommons.LzxState;
-import org.apache.tika.parser.chm.exception.ChmParsingException;
-
-public class ChmLzxState {
-    /* Class' members */
-    private int window; /* the actual decoding window */
-    private long window_size; /* window size (32Kb through 2Mb) */
-    private int window_position; /* current offset within the window */
-    private int main_tree_elements; /* number of main tree elements */
-    private LzxState hadStarted; /* have we started decoding at all yet? */
-    private int block_type; /* type of this block */
-    private int block_length; /* uncompressed length of this block */
-    private int block_remaining; /* uncompressed bytes still left to decode */
-    private int frames_read; /* the number of CFDATA blocks processed */
-    private int intel_file_size; /* magic header value used for transform */
-    private long intel_current_possition; /* current offset in transform space */
-    private IntelState intel_state; /* have we seen any translatable data yet? */
-    private long R0; /* for the LRU offset system */
-    private long R1; /* for the LRU offset system */
-    private long R2; /* for the LRU offset system */
-
-    // Trees - PRETREE, MAINTREE, LENGTH, ALIGNED
-    protected short[] mainTreeLengtsTable;
-    protected short[] mainTreeTable;
-
-    protected short[] lengthTreeTable;
-    protected short[] lengthTreeLengtsTable;
-
-    protected short[] alignedLenTable;
-    protected short[] alignedTreeTable;
-
-    protected short[] getMainTreeTable() {
-        return mainTreeTable;
-    }
-
-    protected short[] getAlignedTreeTable() {
-        return alignedTreeTable;
-    }
-
-    protected void setAlignedTreeTable(short[] alignedTreeTable) {
-        this.alignedTreeTable = alignedTreeTable;
-    }
-
-    protected short[] getLengthTreeTable() throws TikaException {
-        if (lengthTreeTable != null)
-            return this.lengthTreeTable;
-        else
-            throw new ChmParsingException("lengthTreeTable is null");
-    }
-
-    protected void setLengthTreeTable(short[] lengthTreeTable) {
-        this.lengthTreeTable = lengthTreeTable;
-    }
-
-    protected void setMainTreeTable(short[] mainTreeTable) {
-        this.mainTreeTable = mainTreeTable;
-    }
-
-    protected short[] getAlignedLenTable() {
-        return this.alignedLenTable;
-    }
-
-    protected void setAlignedLenTable(short[] alignedLenTable) {
-        this.alignedLenTable = alignedLenTable;
-    }
-
-    /**
-     * It suits for informative outlook
-     */
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append("actual decoding window:=" + getWindow()
-                + System.getProperty("line.separator"));
-        sb.append("window size (32Kb through 2Mb):=" + getWindowSize()
-                + System.getProperty("line.separator"));
-        sb.append("current offset within the window:=" + getWindowPosition()
-                + System.getProperty("line.separator"));
-        sb.append("number of main tree elements:=" + getMainTreeElements()
-                + System.getProperty("line.separator"));
-        sb.append("have we started decoding at all yet?:=" + getHadStarted()
-                + System.getProperty("line.separator"));
-        sb.append("type of this block:=" + getBlockType()
-                + System.getProperty("line.separator"));
-        sb.append("uncompressed length of this block:=" + getBlockLength()
-                + System.getProperty("line.separator"));
-        sb.append("uncompressed bytes still left to decode:="
-                + getBlockRemaining() + System.getProperty("line.separator"));
-        sb.append("the number of CFDATA blocks processed:=" + getFramesRead()
-                + System.getProperty("line.separator"));
-        sb.append("magic header value used for transform:="
-                + getIntelFileSize() + System.getProperty("line.separator"));
-        sb.append("current offset in transform space:="
-                + getIntelCurrentPossition()
-                + System.getProperty("line.separator"));
-        sb.append("have we seen any translatable data yet?:=" + getIntelState()
-                + System.getProperty("line.separator"));
-        sb.append("R0 for the LRU offset system:=" + getR0()
-                + System.getProperty("line.separator"));
-        sb.append("R1 for the LRU offset system:=" + getR1()
-                + System.getProperty("line.separator"));
-        sb.append("R2 for the LRU offset system:=" + getR2()
-                + System.getProperty("line.separator"));
-        sb.append("main tree length:=" + getMainTreeLengtsTable().length
-                + System.getProperty("line.separator"));
-        sb.append("secondary tree length:=" + getLengthTreeLengtsTable().length
-                + System.getProperty("line.separator"));
-        return sb.toString();
-    }
-
-    public ChmLzxState(int window) throws TikaException {
-        if (window >= 0) {
-            int position_slots;
-            int win = ChmCommons.getWindowSize(window);
-            setWindowSize(1 << win);
-            /* LZX supports window sizes of 2^15 (32Kb) through 2^21 (2Mb) */
-            if (win < 15 || win > 21)
-                throw new ChmParsingException("window less than 15 or window greater than 21");
-
-            /* Calculates required position slots */
-            if (win == 20)
-                position_slots = 42;
-            else if (win == 21)
-                position_slots = 50;
-            else
-                position_slots = win << 1;
-
-            setR0(1);
-            setR1(1);
-            setR2(1);
-            setMainTreeElements(512);
-            setHadStarted(LzxState.NOT_STARTED_DECODING);
-            setFramesRead(0);
-            setBlockRemaining(0);
-            setBlockType(ChmConstants.LZX_BLOCKTYPE_INVALID);
-            setIntelCurrentPossition(0);
-            setIntelState(IntelState.NOT_STARTED);
-            setWindowPosition(0);
-            setMainTreeLengtsTable(new short[getMainTreeElements()]);
-            setLengthTreeLengtsTable(new short[ChmConstants.LZX_NUM_SECONDARY_LENGTHS]);
-        } else
-            throw new CancellationException(
-                    "window size should be more than zero");
-    }
-
-    protected void setWindow(int window) {
-        this.window = window;
-    }
-
-    protected int getWindow() {
-        return window;
-    }
-
-    protected void setWindowSize(long window_size) {
-        this.window_size = window_size;
-    }
-
-    protected long getWindowSize() {
-        return window_size;
-    }
-
-    protected void setWindowPosition(int window_position) {
-        this.window_position = window_position;
-    }
-
-    protected int getWindowPosition() {
-        return window_position;
-    }
-
-    protected void setMainTreeElements(int main_tree_elements) {
-        this.main_tree_elements = main_tree_elements;
-    }
-
-    protected int getMainTreeElements() {
-        return main_tree_elements;
-    }
-
-    protected void setHadStarted(LzxState hadStarted) {
-        this.hadStarted = hadStarted;
-    }
-
-    protected LzxState getHadStarted() {
-        return hadStarted;
-    }
-
-    protected void setBlockType(int block_type) {
-        this.block_type = block_type;
-    }
-
-    public int getBlockType() {
-        return block_type;
-    }
-
-    protected void setBlockLength(int block_length) {
-        this.block_length = block_length;
-    }
-
-    protected int getBlockLength() {
-        return block_length;
-    }
-
-    protected void setBlockRemaining(int block_remaining) {
-        this.block_remaining = block_remaining;
-    }
-
-    protected int getBlockRemaining() {
-        return block_remaining;
-    }
-
-    protected void setFramesRead(int frames_read) {
-        this.frames_read = frames_read;
-    }
-
-    protected void increaseFramesRead() {
-        this.frames_read = getFramesRead() + 1;
-    }
-
-    protected int getFramesRead() {
-        return frames_read;
-    }
-
-    protected void setIntelFileSize(int intel_file_size) {
-        this.intel_file_size = intel_file_size;
-    }
-
-    protected int getIntelFileSize() {
-        return intel_file_size;
-    }
-
-    protected void setIntelCurrentPossition(long intel_current_possition) {
-        this.intel_current_possition = intel_current_possition;
-    }
-
-    protected long getIntelCurrentPossition() {
-        return intel_current_possition;
-    }
-
-    protected void setIntelState(IntelState intel_state) {
-        this.intel_state = intel_state;
-    }
-
-    protected IntelState getIntelState() {
-        return intel_state;
-    }
-
-    protected void setR0(long r0) {
-        R0 = r0;
-    }
-
-    protected long getR0() {
-        return R0;
-    }
-
-    protected void setR1(long r1) {
-        R1 = r1;
-    }
-
-    protected long getR1() {
-        return R1;
-    }
-
-    protected void setR2(long r2) {
-        R2 = r2;
-    }
-
-    protected long getR2() {
-        return R2;
-    }
-
-    public static void main(String[] args) {
-    }
-
-    public void setMainTreeLengtsTable(short[] mainTreeLengtsTable) {
-        this.mainTreeLengtsTable = mainTreeLengtsTable;
-    }
-
-    public short[] getMainTreeLengtsTable() {
-        return mainTreeLengtsTable;
-    }
-
-    public void setLengthTreeLengtsTable(short[] lengthTreeLengtsTable) {
-        this.lengthTreeLengtsTable = lengthTreeLengtsTable;
-    }
-
-    public short[] getLengthTreeLengtsTable() {
-        return lengthTreeLengtsTable;
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.parser.chm.lzx;
+
+import java.util.concurrent.CancellationException;
+
+import org.apache.tika.exception.TikaException;
+import org.apache.tika.parser.chm.core.ChmCommons;
+import org.apache.tika.parser.chm.core.ChmConstants;
+import org.apache.tika.parser.chm.core.ChmCommons.IntelState;
+import org.apache.tika.parser.chm.core.ChmCommons.LzxState;
+import org.apache.tika.parser.chm.exception.ChmParsingException;
+
+public class ChmLzxState {
+    /* Class' members */
+    private int window; /* the actual decoding window */
+    private long window_size; /* window size (32Kb through 2Mb) */
+    private int window_position; /* current offset within the window */
+    private int main_tree_elements; /* number of main tree elements */
+    private LzxState hadStarted; /* have we started decoding at all yet? */
+    private int block_type; /* type of this block */
+    private int block_length; /* uncompressed length of this block */
+    private int block_remaining; /* uncompressed bytes still left to decode */
+    private int frames_read; /* the number of CFDATA blocks processed */
+    private int intel_file_size; /* magic header value used for transform */
+    private long intel_current_possition; /* current offset in transform space */
+    private IntelState intel_state; /* have we seen any translatable data yet? */
+    private long R0; /* for the LRU offset system */
+    private long R1; /* for the LRU offset system */
+    private long R2; /* for the LRU offset system */
+
+    // Trees - PRETREE, MAINTREE, LENGTH, ALIGNED
+    protected short[] mainTreeLengtsTable;
+    protected short[] mainTreeTable;
+
+    protected short[] lengthTreeTable;
+    protected short[] lengthTreeLengtsTable;
+
+    protected short[] alignedLenTable;
+    protected short[] alignedTreeTable;
+
+    protected short[] getMainTreeTable() {
+        return mainTreeTable;
+    }
+
+    protected short[] getAlignedTreeTable() {
+        return alignedTreeTable;
+    }
+
+    protected void setAlignedTreeTable(short[] alignedTreeTable) {
+        this.alignedTreeTable = alignedTreeTable;
+    }
+
+    protected short[] getLengthTreeTable() throws TikaException {
+        if (lengthTreeTable != null)
+            return this.lengthTreeTable;
+        else
+            throw new ChmParsingException("lengthTreeTable is null");
+    }
+
+    protected void setLengthTreeTable(short[] lengthTreeTable) {
+        this.lengthTreeTable = lengthTreeTable;
+    }
+
+    protected void setMainTreeTable(short[] mainTreeTable) {
+        this.mainTreeTable = mainTreeTable;
+    }
+
+    protected short[] getAlignedLenTable() {
+        return this.alignedLenTable;
+    }
+
+    protected void setAlignedLenTable(short[] alignedLenTable) {
+        this.alignedLenTable = alignedLenTable;
+    }
+
+    /**
+     * It suits for informative outlook
+     */
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("actual decoding window:=" + getWindow()
+                + System.getProperty("line.separator"));
+        sb.append("window size (32Kb through 2Mb):=" + getWindowSize()
+                + System.getProperty("line.separator"));
+        sb.append("current offset within the window:=" + getWindowPosition()
+                + System.getProperty("line.separator"));
+        sb.append("number of main tree elements:=" + getMainTreeElements()
+                + System.getProperty("line.separator"));
+        sb.append("have we started decoding at all yet?:=" + getHadStarted()
+                + System.getProperty("line.separator"));
+        sb.append("type of this block:=" + getBlockType()
+                + System.getProperty("line.separator"));
+        sb.append("uncompressed length of this block:=" + getBlockLength()
+                + System.getProperty("line.separator"));
+        sb.append("uncompressed bytes still left to decode:="
+                + getBlockRemaining() + System.getProperty("line.separator"));
+        sb.append("the number of CFDATA blocks processed:=" + getFramesRead()
+                + System.getProperty("line.separator"));
+        sb.append("magic header value used for transform:="
+                + getIntelFileSize() + System.getProperty("line.separator"));
+        sb.append("current offset in transform space:="
+                + getIntelCurrentPossition()
+                + System.getProperty("line.separator"));
+        sb.append("have we seen any translatable data yet?:=" + getIntelState()
+                + System.getProperty("line.separator"));
+        sb.append("R0 for the LRU offset system:=" + getR0()
+                + System.getProperty("line.separator"));
+        sb.append("R1 for the LRU offset system:=" + getR1()
+                + System.getProperty("line.separator"));
+        sb.append("R2 for the LRU offset system:=" + getR2()
+                + System.getProperty("line.separator"));
+        sb.append("main tree length:=" + getMainTreeLengtsTable().length
+                + System.getProperty("line.separator"));
+        sb.append("secondary tree length:=" + getLengthTreeLengtsTable().length
+                + System.getProperty("line.separator"));
+        return sb.toString();
+    }
+
+    public ChmLzxState(int window) throws TikaException {
+        if (window >= 0) {
+            int position_slots;
+            int win = ChmCommons.getWindowSize(window);
+            setWindowSize(1 << win);
+            /* LZX supports window sizes of 2^15 (32Kb) through 2^21 (2Mb) */
+            if (win < 15 || win > 21)
+                throw new ChmParsingException("window less than 15 or window greater than 21");
+
+            /* Calculates required position slots */
+            if (win == 20)
+                position_slots = 42;
+            else if (win == 21)
+                position_slots = 50;
+            else
+                position_slots = win << 1;
+
+            setR0(1);
+            setR1(1);
+            setR2(1);
+            setMainTreeElements(512);
+            setHadStarted(LzxState.NOT_STARTED_DECODING);
+            setFramesRead(0);
+            setBlockRemaining(0);
+            setBlockType(ChmConstants.LZX_BLOCKTYPE_INVALID);
+            setIntelCurrentPossition(0);
+            setIntelState(IntelState.NOT_STARTED);
+            setWindowPosition(0);
+            setMainTreeLengtsTable(new short[getMainTreeElements()]);
+            setLengthTreeLengtsTable(new short[ChmConstants.LZX_NUM_SECONDARY_LENGTHS]);
+        } else
+            throw new CancellationException(
+                    "window size should be more than zero");
+    }
+
+    protected void setWindow(int window) {
+        this.window = window;
+    }
+
+    protected int getWindow() {
+        return window;
+    }
+
+    protected void setWindowSize(long window_size) {
+        this.window_size = window_size;
+    }
+
+    protected long getWindowSize() {
+        return window_size;
+    }
+
+    protected void setWindowPosition(int window_position) {
+        this.window_position = window_position;
+    }
+
+    protected int getWindowPosition() {
+        return window_position;
+    }
+
+    protected void setMainTreeElements(int main_tree_elements) {
+        this.main_tree_elements = main_tree_elements;
+    }
+
+    protected int getMainTreeElements() {
+        return main_tree_elements;
+    }
+
+    protected void setHadStarted(LzxState hadStarted) {
+        this.hadStarted = hadStarted;
+    }
+
+    protected LzxState getHadStarted() {
+        return hadStarted;
+    }
+
+    protected void setBlockType(int block_type) {
+        this.block_type = block_type;
+    }
+
+    public int getBlockType() {
+        return block_type;
+    }
+
+    protected void setBlockLength(int block_length) {
+        this.block_length = block_length;
+    }
+
+    protected int getBlockLength() {
+        return block_length;
+    }
+
+    protected void setBlockRemaining(int block_remaining) {
+        this.block_remaining = block_remaining;
+    }
+
+    protected int getBlockRemaining() {
+        return block_remaining;
+    }
+
+    protected void setFramesRead(int frames_read) {
+        this.frames_read = frames_read;
+    }
+
+    protected void increaseFramesRead() {
+        this.frames_read = getFramesRead() + 1;
+    }
+
+    protected int getFramesRead() {
+        return frames_read;
+    }
+
+    protected void setIntelFileSize(int intel_file_size) {
+        this.intel_file_size = intel_file_size;
+    }
+
+    protected int getIntelFileSize() {
+        return intel_file_size;
+    }
+
+    protected void setIntelCurrentPossition(long intel_current_possition) {
+        this.intel_current_possition = intel_current_possition;
+    }
+
+    protected long getIntelCurrentPossition() {
+        return intel_current_possition;
+    }
+
+    protected void setIntelState(IntelState intel_state) {
+        this.intel_state = intel_state;
+    }
+
+    protected IntelState getIntelState() {
+        return intel_state;
+    }
+
+    protected void setR0(long r0) {
+        R0 = r0;
+    }
+
+    protected long getR0() {
+        return R0;
+    }
+
+    protected void setR1(long r1) {
+        R1 = r1;
+    }
+
+    protected long getR1() {
+        return R1;
+    }
+
+    protected void setR2(long r2) {
+        R2 = r2;
+    }
+
+    protected long getR2() {
+        return R2;
+    }
+
+    public static void main(String[] args) {
+    }
+
+    public void setMainTreeLengtsTable(short[] mainTreeLengtsTable) {
+        this.mainTreeLengtsTable = mainTreeLengtsTable;
+    }
+
+    public short[] getMainTreeLengtsTable() {
+        return mainTreeLengtsTable;
+    }
+
+    public void setLengthTreeLengtsTable(short[] lengthTreeLengtsTable) {
+        this.lengthTreeLengtsTable = lengthTreeLengtsTable;
+    }
+
+    public short[] getLengthTreeLengtsTable() {
+        return lengthTreeLengtsTable;
+    }
+}

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/chm/lzx/ChmLzxState.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/chm/lzx/ChmSection.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/chm/lzx/ChmSection.java?rev=1172242&r1=1172241&r2=1172242&view=diff
==============================================================================
--- tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/chm/lzx/ChmSection.java (original)
+++ tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/chm/lzx/ChmSection.java Sun Sep 18 10:39:08 2011
@@ -1,207 +1,207 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tika.parser.chm.lzx;
-
-import java.math.BigInteger;
-import java.util.Arrays;
-
-import org.apache.tika.exception.TikaException;
-import org.apache.tika.parser.chm.core.ChmCommons;
-
-public class ChmSection {
-    private byte[] data;
-    private int swath;// kiks
-    private int total;// remains
-    private int buffer;// val
-
-    public ChmSection(byte[] data) throws TikaException {
-        ChmCommons.assertByteArrayNotNull(data);
-        setData(data);
-    }
-
-    /* Utilities */
-    public byte[] reverseByteOrder(byte[] toBeReversed) throws TikaException {
-        ChmCommons.assertByteArrayNotNull(toBeReversed);
-        ChmCommons.reverse(toBeReversed);
-        return toBeReversed;
-    }
-
-    public int checkBit(int i) {
-        return ((getBuffer() & (1 << (getTotal() - i))) == 0) ? 0 : 1;
-    }
-
-    public int getSyncBits(int bit) {
-        return getDesyncBits(bit, bit);
-    }
-
-    public int getDesyncBits(int bit, int removeBit) {
-        while (getTotal() < 16) {
-            setBuffer((getBuffer() << 16) + unmarshalUByte()
-                    + (unmarshalUByte() << 8));
-            setTotal(getTotal() + 16);
-        }
-        int tmp = (getBuffer() >>> (getTotal() - bit));
-        setTotal(getTotal() - removeBit);
-        setBuffer(getBuffer() - ((getBuffer() >>> getTotal()) << getTotal()));
-        return tmp;
-    }
-
-    public int unmarshalUByte() {
-        return (int) (getByte() & 255);
-    }
-
-    public byte getByte() {
-        if (getSwath() < getData().length) {
-            setSwath(getSwath() + 1);
-            return getData()[getSwath() - 1];
-        } else
-            return 0;
-    }
-
-    public int getLeft() {
-        return (getData().length - getSwath());
-    }
-
-    public byte[] getData() {
-        return data;
-    }
-
-    public BigInteger getBigInteger(int i) {
-        if (getData() == null)
-            return BigInteger.ZERO;
-        if (getData().length - getSwath() < i)
-            i = getData().length - getSwath();
-        byte[] tmp = new byte[i];
-        for (int j = i - 1; j >= 0; j--) {
-            tmp[i - j - 1] = getData()[getSwath() + j];
-        }
-        setSwath(getSwath() + i);
-        return new BigInteger(tmp);
-    }
-
-    public byte[] stringToAsciiBytes(String s) {
-        char[] c = s.toCharArray();
-        byte[] byteval = new byte[c.length];
-        for (int i = 0; i < c.length; i++)
-            byteval[i] = (byte) c[i];
-        return byteval;
-    }
-
-    public BigInteger unmarshalUlong() {
-        return getBigInteger(8);
-    }
-
-    public long unmarshalUInt() {
-        return getBigInteger(4).longValue();
-    }
-
-    public int unmarshalInt() {
-        return getBigInteger(4).intValue();
-    }
-
-    public byte[] unmarshalBytes(int i) {
-        if (i == 0)
-            return new byte[1];
-        byte[] t = new byte[i];
-        for (int j = 0; j < i; j++)
-            t[j] = getData()[j + getSwath()];
-        setSwath(getSwath() + i);
-        return t;
-    }
-
-    public BigInteger getEncint() {
-        byte ob;
-        BigInteger bi = BigInteger.ZERO;
-        byte[] nb = new byte[1];
-        while ((ob = this.getByte()) < 0) {
-            nb[0] = (byte) ((ob & 0x7f));
-            bi = bi.shiftLeft(7).add(new BigInteger(nb));
-        }
-        nb[0] = (byte) ((ob & 0x7f));
-        bi = bi.shiftLeft(7).add(new BigInteger(nb));
-        return bi;
-    }
-
-    public char unmarshalUtfChar() {
-        byte ob;
-        int i = 1;
-        byte[] ba;
-        ob = this.getByte();
-        if (ob < 0) {
-            i = 2;
-            while ((ob << (24 + i)) < 0)
-                i++;
-        }
-        ba = new byte[i];
-        ba[0] = ob;
-        int j = 1;
-        while (j < i) {
-            ba[j] = this.getByte();
-            j++;
-        }
-        i = ba.length;
-        if (i == 1)
-            return (char) ba[0];
-        else {
-            int n;
-            n = ba[0] & 15; // 00001111b, gets last 4 bits
-            j = 1;
-            while (j < i)
-                n = (n << 6) + (ba[j++] & 63);// 00111111b,gets last 6 bits
-            return (char) n;
-        }
-    }
-
-    private void setData(byte[] data) {
-        this.data = data;
-    }
-
-    public int getSwath() {
-        return swath;
-    }
-
-    public void setSwath(int swath) {
-        this.swath = swath;
-    }
-
-    public int getTotal() {
-        return total;
-    }
-
-    public void setTotal(int total) {
-        this.total = total;
-    }
-
-    private int getBuffer() {
-        return buffer;
-    }
-
-    private void setBuffer(int buffer) {
-        this.buffer = buffer;
-    }
-
-    /**
-     * @param args
-     * @throws TikaException 
-     */
-    public static void main(String[] args) throws TikaException {
-        byte[] array = { 4, 78, -67, 90, 1, -33 };
-        ChmSection chmSection = new ChmSection(array);
-        System.out.println("before " + Arrays.toString(array));
-        System.out.println("after " + Arrays.toString(chmSection.reverseByteOrder(array)));
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.parser.chm.lzx;
+
+import java.math.BigInteger;
+import java.util.Arrays;
+
+import org.apache.tika.exception.TikaException;
+import org.apache.tika.parser.chm.core.ChmCommons;
+
+public class ChmSection {
+    private byte[] data;
+    private int swath;// kiks
+    private int total;// remains
+    private int buffer;// val
+
+    public ChmSection(byte[] data) throws TikaException {
+        ChmCommons.assertByteArrayNotNull(data);
+        setData(data);
+    }
+
+    /* Utilities */
+    public byte[] reverseByteOrder(byte[] toBeReversed) throws TikaException {
+        ChmCommons.assertByteArrayNotNull(toBeReversed);
+        ChmCommons.reverse(toBeReversed);
+        return toBeReversed;
+    }
+
+    public int checkBit(int i) {
+        return ((getBuffer() & (1 << (getTotal() - i))) == 0) ? 0 : 1;
+    }
+
+    public int getSyncBits(int bit) {
+        return getDesyncBits(bit, bit);
+    }
+
+    public int getDesyncBits(int bit, int removeBit) {
+        while (getTotal() < 16) {
+            setBuffer((getBuffer() << 16) + unmarshalUByte()
+                    + (unmarshalUByte() << 8));
+            setTotal(getTotal() + 16);
+        }
+        int tmp = (getBuffer() >>> (getTotal() - bit));
+        setTotal(getTotal() - removeBit);
+        setBuffer(getBuffer() - ((getBuffer() >>> getTotal()) << getTotal()));
+        return tmp;
+    }
+
+    public int unmarshalUByte() {
+        return (int) (getByte() & 255);
+    }
+
+    public byte getByte() {
+        if (getSwath() < getData().length) {
+            setSwath(getSwath() + 1);
+            return getData()[getSwath() - 1];
+        } else
+            return 0;
+    }
+
+    public int getLeft() {
+        return (getData().length - getSwath());
+    }
+
+    public byte[] getData() {
+        return data;
+    }
+
+    public BigInteger getBigInteger(int i) {
+        if (getData() == null)
+            return BigInteger.ZERO;
+        if (getData().length - getSwath() < i)
+            i = getData().length - getSwath();
+        byte[] tmp = new byte[i];
+        for (int j = i - 1; j >= 0; j--) {
+            tmp[i - j - 1] = getData()[getSwath() + j];
+        }
+        setSwath(getSwath() + i);
+        return new BigInteger(tmp);
+    }
+
+    public byte[] stringToAsciiBytes(String s) {
+        char[] c = s.toCharArray();
+        byte[] byteval = new byte[c.length];
+        for (int i = 0; i < c.length; i++)
+            byteval[i] = (byte) c[i];
+        return byteval;
+    }
+
+    public BigInteger unmarshalUlong() {
+        return getBigInteger(8);
+    }
+
+    public long unmarshalUInt() {
+        return getBigInteger(4).longValue();
+    }
+
+    public int unmarshalInt() {
+        return getBigInteger(4).intValue();
+    }
+
+    public byte[] unmarshalBytes(int i) {
+        if (i == 0)
+            return new byte[1];
+        byte[] t = new byte[i];
+        for (int j = 0; j < i; j++)
+            t[j] = getData()[j + getSwath()];
+        setSwath(getSwath() + i);
+        return t;
+    }
+
+    public BigInteger getEncint() {
+        byte ob;
+        BigInteger bi = BigInteger.ZERO;
+        byte[] nb = new byte[1];
+        while ((ob = this.getByte()) < 0) {
+            nb[0] = (byte) ((ob & 0x7f));
+            bi = bi.shiftLeft(7).add(new BigInteger(nb));
+        }
+        nb[0] = (byte) ((ob & 0x7f));
+        bi = bi.shiftLeft(7).add(new BigInteger(nb));
+        return bi;
+    }
+
+    public char unmarshalUtfChar() {
+        byte ob;
+        int i = 1;
+        byte[] ba;
+        ob = this.getByte();
+        if (ob < 0) {
+            i = 2;
+            while ((ob << (24 + i)) < 0)
+                i++;
+        }
+        ba = new byte[i];
+        ba[0] = ob;
+        int j = 1;
+        while (j < i) {
+            ba[j] = this.getByte();
+            j++;
+        }
+        i = ba.length;
+        if (i == 1)
+            return (char) ba[0];
+        else {
+            int n;
+            n = ba[0] & 15; // 00001111b, gets last 4 bits
+            j = 1;
+            while (j < i)
+                n = (n << 6) + (ba[j++] & 63);// 00111111b,gets last 6 bits
+            return (char) n;
+        }
+    }
+
+    private void setData(byte[] data) {
+        this.data = data;
+    }
+
+    public int getSwath() {
+        return swath;
+    }
+
+    public void setSwath(int swath) {
+        this.swath = swath;
+    }
+
+    public int getTotal() {
+        return total;
+    }
+
+    public void setTotal(int total) {
+        this.total = total;
+    }
+
+    private int getBuffer() {
+        return buffer;
+    }
+
+    private void setBuffer(int buffer) {
+        this.buffer = buffer;
+    }
+
+    /**
+     * @param args
+     * @throws TikaException 
+     */
+    public static void main(String[] args) throws TikaException {
+        byte[] array = { 4, 78, -67, 90, 1, -33 };
+        ChmSection chmSection = new ChmSection(array);
+        System.out.println("before " + Arrays.toString(array));
+        System.out.println("after " + Arrays.toString(chmSection.reverseByteOrder(array)));
+    }
+}

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/chm/lzx/ChmSection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/epub/EpubContentParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/epub/EpubParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/html/DefaultHtmlMapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/html/HtmlHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/html/HtmlMapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/image/ImageMetadataExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/image/MetadataFields.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/image/xmp/JempboxExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/image/xmp/XMPPacketScanner.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/iwork/IWorkPackageParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/mbox/MboxParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/microsoft/AbstractPOIFSExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/microsoft/HSLFExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/microsoft/POIFSContainerDetector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/microsoft/TNEFParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/microsoft/WordExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/mp3/AudioFrame.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/mp3/CompositeTagHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/mp3/ID3Tags.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/mp3/ID3v1Handler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/mp3/ID3v22Handler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/mp3/ID3v23Handler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/mp3/ID3v24Handler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/mp3/ID3v2Frame.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/mp3/MP3Frame.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/netcdf/NetCDFParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/odf/NSNormalizerContentHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/pkg/ZipContainerDetector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/prt/PRTParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/txt/CharsetDetector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/txt/CharsetMatch.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/txt/CharsetRecog_2022.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/txt/CharsetRecog_UTF8.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/txt/CharsetRecog_Unicode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/txt/CharsetRecog_mbcs.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/txt/CharsetRecog_sbcs.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/txt/CharsetRecognizer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/video/FLVParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/xml/AttributeDependantMetadataHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/xml/AttributeMetadataHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/xml/FictionBookParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/test/java/org/apache/tika/TikaTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tika/trunk/tika-parsers/src/test/java/org/apache/tika/detect/TestContainerAwareDetector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmBlockInfo.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmBlockInfo.java?rev=1172242&r1=1172241&r2=1172242&view=diff
==============================================================================
--- tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmBlockInfo.java (original)
+++ tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmBlockInfo.java Sun Sep 18 10:39:08 2011
@@ -1,122 +1,122 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tika.parser.chm;
-
-import java.util.Iterator;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.tika.parser.chm.accessor.ChmDirectoryListingSet;
-import org.apache.tika.parser.chm.accessor.ChmItsfHeader;
-import org.apache.tika.parser.chm.accessor.ChmItspHeader;
-import org.apache.tika.parser.chm.accessor.ChmLzxcControlData;
-import org.apache.tika.parser.chm.accessor.ChmLzxcResetTable;
-import org.apache.tika.parser.chm.accessor.DirectoryListingEntry;
-import org.apache.tika.parser.chm.core.ChmCommons;
-import org.apache.tika.parser.chm.core.ChmConstants;
-import org.apache.tika.parser.chm.lzx.ChmBlockInfo;
-
-/**
- * Tests major functionality of ChmBlockInfo
- * 
- */
-public class TestChmBlockInfo extends TestCase {
-    private byte[] data;
-    private ChmBlockInfo chmBlockInfo;
-    private ChmDirectoryListingSet chmDirListCont = null;
-    private ChmLzxcResetTable clrt = null;
-    private ChmLzxcControlData chmLzxcControlData = null;
-
-    public void setUp() throws Exception {
-        data = TestParameters.chmData;
-        /* Creates and parses itsf header */
-        ChmItsfHeader chmItsHeader = new ChmItsfHeader();
-        // chmItsHeader.parse(Arrays.copyOfRange(data, 0,
-        // ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsHeader);
-        chmItsHeader.parse(ChmCommons.copyOfRange(data, 0,
-                ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsHeader);
-        /* Creates and parses itsp block */
-        ChmItspHeader chmItspHeader = new ChmItspHeader();
-        // chmItspHeader.parse(Arrays.copyOfRange( data, (int)
-        // chmItsHeader.getDirOffset(),
-        // (int) chmItsHeader.getDirOffset()
-        // + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
-        chmItspHeader.parse(ChmCommons.copyOfRange(data,
-                (int) chmItsHeader.getDirOffset(),
-                (int) chmItsHeader.getDirOffset()
-                        + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
-        /* Creating instance of ChmDirListingContainer */
-        chmDirListCont = new ChmDirectoryListingSet(data, chmItsHeader,
-                chmItspHeader);
-        int indexOfControlData = chmDirListCont.getControlDataIndex();
-
-        int indexOfResetTable = ChmCommons.indexOfResetTableBlock(data,
-                ChmConstants.LZXC.getBytes());
-        byte[] dir_chunk = null;
-        if (indexOfResetTable > 0) {
-            // dir_chunk = Arrays.copyOfRange( data, indexOfResetTable,
-            // indexOfResetTable
-            // +
-            // chmDirListCont.getDirectoryListingEntryList().get(indexOfControlData).getLength());
-            dir_chunk = ChmCommons.copyOfRange(data, indexOfResetTable,
-                    indexOfResetTable
-                            + chmDirListCont.getDirectoryListingEntryList()
-                                    .get(indexOfControlData).getLength());
-        }
-
-        /* Creates and parses control block */
-        chmLzxcControlData = new ChmLzxcControlData();
-        chmLzxcControlData.parse(dir_chunk, chmLzxcControlData);
-
-        int indexOfFeList = chmDirListCont.getResetTableIndex();
-        int startIndex = (int) chmDirListCont.getDataOffset()
-                + chmDirListCont.getDirectoryListingEntryList()
-                        .get(indexOfFeList).getOffset();
-        // dir_chunk = Arrays.copyOfRange(data, startIndex , startIndex +
-        // chmDirListCont.getDirectoryListingEntryList().get(indexOfFeList).getLength());
-        dir_chunk = ChmCommons.copyOfRange(data, startIndex, startIndex
-                        + chmDirListCont.getDirectoryListingEntryList().get(indexOfFeList).getLength());
-        clrt = new ChmLzxcResetTable();
-        clrt.parse(dir_chunk, clrt);
-    }
-
-    public void testToString() {
-        if (chmBlockInfo == null)
-            testGetChmBlockInfo();
-        Assert.assertTrue(chmBlockInfo.toString().length() > 0);
-    }
-
-    public void testGetChmBlockInfo() {
-        for (Iterator<DirectoryListingEntry> it = chmDirListCont
-                .getDirectoryListingEntryList().iterator(); it.hasNext();) {
-            DirectoryListingEntry directoryListingEntry = it.next();
-            chmBlockInfo = ChmBlockInfo.getChmBlockInfoInstance(
-                    directoryListingEntry, (int) clrt.getBlockLen(),
-                    chmLzxcControlData);
-            // Assert.assertTrue(!directoryListingEntry.getName().isEmpty() &&
-            // chmBlockInfo.toString() != null);
-            Assert.assertTrue(!ChmCommons.isEmpty(directoryListingEntry
-                    .getName()) && chmBlockInfo.toString() != null);
-        }
-    }
-
-    public void tearDown() throws Exception {
-        data = null;
-        chmBlockInfo = null;
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.parser.chm;
+
+import java.util.Iterator;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tika.parser.chm.accessor.ChmDirectoryListingSet;
+import org.apache.tika.parser.chm.accessor.ChmItsfHeader;
+import org.apache.tika.parser.chm.accessor.ChmItspHeader;
+import org.apache.tika.parser.chm.accessor.ChmLzxcControlData;
+import org.apache.tika.parser.chm.accessor.ChmLzxcResetTable;
+import org.apache.tika.parser.chm.accessor.DirectoryListingEntry;
+import org.apache.tika.parser.chm.core.ChmCommons;
+import org.apache.tika.parser.chm.core.ChmConstants;
+import org.apache.tika.parser.chm.lzx.ChmBlockInfo;
+
+/**
+ * Tests major functionality of ChmBlockInfo
+ * 
+ */
+public class TestChmBlockInfo extends TestCase {
+    private byte[] data;
+    private ChmBlockInfo chmBlockInfo;
+    private ChmDirectoryListingSet chmDirListCont = null;
+    private ChmLzxcResetTable clrt = null;
+    private ChmLzxcControlData chmLzxcControlData = null;
+
+    public void setUp() throws Exception {
+        data = TestParameters.chmData;
+        /* Creates and parses itsf header */
+        ChmItsfHeader chmItsHeader = new ChmItsfHeader();
+        // chmItsHeader.parse(Arrays.copyOfRange(data, 0,
+        // ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsHeader);
+        chmItsHeader.parse(ChmCommons.copyOfRange(data, 0,
+                ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsHeader);
+        /* Creates and parses itsp block */
+        ChmItspHeader chmItspHeader = new ChmItspHeader();
+        // chmItspHeader.parse(Arrays.copyOfRange( data, (int)
+        // chmItsHeader.getDirOffset(),
+        // (int) chmItsHeader.getDirOffset()
+        // + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
+        chmItspHeader.parse(ChmCommons.copyOfRange(data,
+                (int) chmItsHeader.getDirOffset(),
+                (int) chmItsHeader.getDirOffset()
+                        + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
+        /* Creating instance of ChmDirListingContainer */
+        chmDirListCont = new ChmDirectoryListingSet(data, chmItsHeader,
+                chmItspHeader);
+        int indexOfControlData = chmDirListCont.getControlDataIndex();
+
+        int indexOfResetTable = ChmCommons.indexOfResetTableBlock(data,
+                ChmConstants.LZXC.getBytes());
+        byte[] dir_chunk = null;
+        if (indexOfResetTable > 0) {
+            // dir_chunk = Arrays.copyOfRange( data, indexOfResetTable,
+            // indexOfResetTable
+            // +
+            // chmDirListCont.getDirectoryListingEntryList().get(indexOfControlData).getLength());
+            dir_chunk = ChmCommons.copyOfRange(data, indexOfResetTable,
+                    indexOfResetTable
+                            + chmDirListCont.getDirectoryListingEntryList()
+                                    .get(indexOfControlData).getLength());
+        }
+
+        /* Creates and parses control block */
+        chmLzxcControlData = new ChmLzxcControlData();
+        chmLzxcControlData.parse(dir_chunk, chmLzxcControlData);
+
+        int indexOfFeList = chmDirListCont.getResetTableIndex();
+        int startIndex = (int) chmDirListCont.getDataOffset()
+                + chmDirListCont.getDirectoryListingEntryList()
+                        .get(indexOfFeList).getOffset();
+        // dir_chunk = Arrays.copyOfRange(data, startIndex , startIndex +
+        // chmDirListCont.getDirectoryListingEntryList().get(indexOfFeList).getLength());
+        dir_chunk = ChmCommons.copyOfRange(data, startIndex, startIndex
+                        + chmDirListCont.getDirectoryListingEntryList().get(indexOfFeList).getLength());
+        clrt = new ChmLzxcResetTable();
+        clrt.parse(dir_chunk, clrt);
+    }
+
+    public void testToString() {
+        if (chmBlockInfo == null)
+            testGetChmBlockInfo();
+        Assert.assertTrue(chmBlockInfo.toString().length() > 0);
+    }
+
+    public void testGetChmBlockInfo() {
+        for (Iterator<DirectoryListingEntry> it = chmDirListCont
+                .getDirectoryListingEntryList().iterator(); it.hasNext();) {
+            DirectoryListingEntry directoryListingEntry = it.next();
+            chmBlockInfo = ChmBlockInfo.getChmBlockInfoInstance(
+                    directoryListingEntry, (int) clrt.getBlockLen(),
+                    chmLzxcControlData);
+            // Assert.assertTrue(!directoryListingEntry.getName().isEmpty() &&
+            // chmBlockInfo.toString() != null);
+            Assert.assertTrue(!ChmCommons.isEmpty(directoryListingEntry
+                    .getName()) && chmBlockInfo.toString() != null);
+        }
+    }
+
+    public void tearDown() throws Exception {
+        data = null;
+        chmBlockInfo = null;
+    }
+}

Propchange: tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmBlockInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmDocumentInformation.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmDocumentInformation.java?rev=1172242&r1=1172241&r2=1172242&view=diff
==============================================================================
--- tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmDocumentInformation.java (original)
+++ tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmDocumentInformation.java Sun Sep 18 10:39:08 2011
@@ -1,52 +1,52 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tika.parser.chm;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.tika.exception.TikaException;
-import org.apache.tika.metadata.Metadata;
-
-public class TestChmDocumentInformation extends TestCase {
-    private CHMDocumentInformation chmDoc = null;
-
-    public void setUp() throws Exception {
-        chmDoc = CHMDocumentInformation.load(
-                new ByteArrayInputStream(TestParameters.chmData));
-    }
-
-    public void testGetCHMDocInformation() throws TikaException, IOException {
-        Metadata md = new Metadata();
-        chmDoc.getCHMDocInformation(md);
-        Assert.assertEquals(TestParameters.VP_CHM_MIME_TYPE, md.toString()
-                .trim());
-    }
-
-    public void testGetText() throws TikaException {
-        Assert.assertTrue(chmDoc.getText().contains(
-                "The TCard method accepts only numeric arguments"));
-    }
-
-    public void tearDown() throws Exception {
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tika.parser.chm;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tika.exception.TikaException;
+import org.apache.tika.metadata.Metadata;
+
+public class TestChmDocumentInformation extends TestCase {
+    private CHMDocumentInformation chmDoc = null;
+
+    public void setUp() throws Exception {
+        chmDoc = CHMDocumentInformation.load(
+                new ByteArrayInputStream(TestParameters.chmData));
+    }
+
+    public void testGetCHMDocInformation() throws TikaException, IOException {
+        Metadata md = new Metadata();
+        chmDoc.getCHMDocInformation(md);
+        Assert.assertEquals(TestParameters.VP_CHM_MIME_TYPE, md.toString()
+                .trim());
+    }
+
+    public void testGetText() throws TikaException {
+        Assert.assertTrue(chmDoc.getText().contains(
+                "The TCard method accepts only numeric arguments"));
+    }
+
+    public void tearDown() throws Exception {
+    }
+
+}

Propchange: tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmDocumentInformation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmExtraction.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmExtraction.java?rev=1172242&r1=1172241&r2=1172242&view=diff
==============================================================================
--- tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmExtraction.java (original)
+++ tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmExtraction.java Sun Sep 18 10:39:08 2011
@@ -1,82 +1,82 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tika.parser.chm;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import junit.framework.TestCase;
-
-import org.apache.tika.metadata.Metadata;
-
-public class TestChmExtraction extends TestCase {
-
-    private List<String> files = new ArrayList<String>();
-
-    public void setUp() {
-        files.add("/test-documents/testChm.chm");
-        files.add("/test-documents/testChm3.chm");
-    }
-
-    public void testMultiThreadedChmExtraction() throws InterruptedException {
-        ExecutorService executor = Executors
-                .newFixedThreadPool(TestParameters.NTHREADS);
-        for (int i = 0; i < TestParameters.NTHREADS; i++) {
-            executor.execute(new Runnable() {
-                public void run() {
-                    Lock mutex = new ReentrantLock();
-                    for (String fileName : files) {
-                        InputStream stream = null;
-                        try {
-                            stream = TestChmExtraction.class.getResourceAsStream(fileName);
-
-                            CHMDocumentInformation chmDocInfo = CHMDocumentInformation
-                                    .load(stream);
-                            Metadata md = new Metadata();
-                            mutex.lock();
-                            String text = chmDocInfo.getText();
-                            chmDocInfo.getCHMDocInformation(md);
-                            assertEquals(TestParameters.VP_CHM_MIME_TYPE, md.toString().trim());
-                            assertTrue(text.length() > 0);
-                        } catch (Exception e) {
-                            e.printStackTrace();
-                        } finally {
-                            try {
-                                stream.close();
-                            } catch (IOException e) {
-                                e.printStackTrace();
-                            }
-                            mutex.unlock();
-                        }
-                    }
-                }
-            });
-        }
-        executor.shutdown();
-        // Waits until all threads will have finished
-        while (!executor.isTerminated()) {
-            Thread.sleep(500);
-        }
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tika.parser.chm;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import junit.framework.TestCase;
+
+import org.apache.tika.metadata.Metadata;
+
+public class TestChmExtraction extends TestCase {
+
+    private List<String> files = new ArrayList<String>();
+
+    public void setUp() {
+        files.add("/test-documents/testChm.chm");
+        files.add("/test-documents/testChm3.chm");
+    }
+
+    public void testMultiThreadedChmExtraction() throws InterruptedException {
+        ExecutorService executor = Executors
+                .newFixedThreadPool(TestParameters.NTHREADS);
+        for (int i = 0; i < TestParameters.NTHREADS; i++) {
+            executor.execute(new Runnable() {
+                public void run() {
+                    Lock mutex = new ReentrantLock();
+                    for (String fileName : files) {
+                        InputStream stream = null;
+                        try {
+                            stream = TestChmExtraction.class.getResourceAsStream(fileName);
+
+                            CHMDocumentInformation chmDocInfo = CHMDocumentInformation
+                                    .load(stream);
+                            Metadata md = new Metadata();
+                            mutex.lock();
+                            String text = chmDocInfo.getText();
+                            chmDocInfo.getCHMDocInformation(md);
+                            assertEquals(TestParameters.VP_CHM_MIME_TYPE, md.toString().trim());
+                            assertTrue(text.length() > 0);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        } finally {
+                            try {
+                                stream.close();
+                            } catch (IOException e) {
+                                e.printStackTrace();
+                            }
+                            mutex.unlock();
+                        }
+                    }
+                }
+            });
+        }
+        executor.shutdown();
+        // Waits until all threads will have finished
+        while (!executor.isTerminated()) {
+            Thread.sleep(500);
+        }
+    }
+}

Propchange: tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmExtraction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmExtractor.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmExtractor.java?rev=1172242&r1=1172241&r2=1172242&view=diff
==============================================================================
--- tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmExtractor.java (original)
+++ tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmExtractor.java Sun Sep 18 10:39:08 2011
@@ -1,90 +1,90 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tika.parser.chm;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.tika.exception.TikaException;
-import org.apache.tika.metadata.Metadata;
-import org.apache.tika.parser.chm.accessor.ChmDirectoryListingSet;
-import org.apache.tika.parser.chm.accessor.DirectoryListingEntry;
-import org.apache.tika.parser.chm.core.ChmExtractor;
-
-public class TestChmExtractor extends TestCase {
-    private ChmExtractor chmExtractor = null;
-
-    public void setUp() throws Exception {
-        chmExtractor = new ChmExtractor(
-                new ByteArrayInputStream(TestParameters.chmData));
-    }
-
-    public void testEnumerateChm() {
-        List<String> chmEntries = chmExtractor.enumerateChm();
-        Assert.assertEquals(TestParameters.VP_CHM_ENTITIES_NUMBER,
-                chmEntries.size());
-    }
-
-    public void testGetChmDirList() {
-        Assert.assertNotNull(chmExtractor.getChmDirList());
-    }
-
-    public void testExtractChmEntry() throws TikaException{
-        ChmDirectoryListingSet entries = chmExtractor.getChmDirList();
-        byte[][] localFile;
-        int count = 0;
-        for (Iterator<DirectoryListingEntry> it = entries
-                .getDirectoryListingEntryList().iterator(); it.hasNext();) {
-            localFile = chmExtractor.extractChmEntry(it.next());
-            if (localFile != null) {
-                ++count;
-            }
-        }
-        Assert.assertEquals(TestParameters.VP_CHM_ENTITIES_NUMBER, count);
-    }
-
-    public void testChmParser() throws Exception{
-        List<String> files = new ArrayList<String>();
-        files.add("/test-documents/testChm.chm");
-        files.add("/test-documents/testChm3.chm");
-
-        for (String fileName : files) {
-            InputStream stream =
-                    TestChmBlockInfo.class.getResourceAsStream(fileName);
-            try {
-                CHMDocumentInformation chmDocInfo = CHMDocumentInformation.load(stream);
-                Metadata md = new Metadata();
-                String text = chmDocInfo.getText();
-                chmDocInfo.getCHMDocInformation(md);
-                assertEquals(TestParameters.VP_CHM_MIME_TYPE, md.toString().trim());
-                assertTrue(text.length() > 0);
-            } finally {
-                stream.close();
-            }
-        }
-    }
-
-    public void tearDown() throws Exception {
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.parser.chm;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tika.exception.TikaException;
+import org.apache.tika.metadata.Metadata;
+import org.apache.tika.parser.chm.accessor.ChmDirectoryListingSet;
+import org.apache.tika.parser.chm.accessor.DirectoryListingEntry;
+import org.apache.tika.parser.chm.core.ChmExtractor;
+
+public class TestChmExtractor extends TestCase {
+    private ChmExtractor chmExtractor = null;
+
+    public void setUp() throws Exception {
+        chmExtractor = new ChmExtractor(
+                new ByteArrayInputStream(TestParameters.chmData));
+    }
+
+    public void testEnumerateChm() {
+        List<String> chmEntries = chmExtractor.enumerateChm();
+        Assert.assertEquals(TestParameters.VP_CHM_ENTITIES_NUMBER,
+                chmEntries.size());
+    }
+
+    public void testGetChmDirList() {
+        Assert.assertNotNull(chmExtractor.getChmDirList());
+    }
+
+    public void testExtractChmEntry() throws TikaException{
+        ChmDirectoryListingSet entries = chmExtractor.getChmDirList();
+        byte[][] localFile;
+        int count = 0;
+        for (Iterator<DirectoryListingEntry> it = entries
+                .getDirectoryListingEntryList().iterator(); it.hasNext();) {
+            localFile = chmExtractor.extractChmEntry(it.next());
+            if (localFile != null) {
+                ++count;
+            }
+        }
+        Assert.assertEquals(TestParameters.VP_CHM_ENTITIES_NUMBER, count);
+    }
+
+    public void testChmParser() throws Exception{
+        List<String> files = new ArrayList<String>();
+        files.add("/test-documents/testChm.chm");
+        files.add("/test-documents/testChm3.chm");
+
+        for (String fileName : files) {
+            InputStream stream =
+                    TestChmBlockInfo.class.getResourceAsStream(fileName);
+            try {
+                CHMDocumentInformation chmDocInfo = CHMDocumentInformation.load(stream);
+                Metadata md = new Metadata();
+                String text = chmDocInfo.getText();
+                chmDocInfo.getCHMDocInformation(md);
+                assertEquals(TestParameters.VP_CHM_MIME_TYPE, md.toString().trim());
+                assertTrue(text.length() > 0);
+            } finally {
+                stream.close();
+            }
+        }
+    }
+
+    public void tearDown() throws Exception {
+    }
+
+}

Propchange: tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmItsfHeader.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmItsfHeader.java?rev=1172242&r1=1172241&r2=1172242&view=diff
==============================================================================
--- tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmItsfHeader.java (original)
+++ tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmItsfHeader.java Sun Sep 18 10:39:08 2011
@@ -1,104 +1,104 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tika.parser.chm;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.tika.parser.chm.accessor.ChmItsfHeader;
-import org.apache.tika.parser.chm.core.ChmCommons;
-import org.apache.tika.parser.chm.core.ChmConstants;
-
-/**
- * Tests all public functions of ChmItsfHeader
- * 
- */
-public class TestChmItsfHeader extends TestCase {
-    private ChmItsfHeader chmItsfHeader = null;
-
-    public void setUp() throws Exception {
-        chmItsfHeader = new ChmItsfHeader();
-        byte[] data = TestParameters.chmData;
-        // chmItsfHeader.parse(Arrays.copyOfRange(data, 0,
-        // ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsfHeader);
-        chmItsfHeader.parse(ChmCommons.copyOfRange(data, 0,
-                ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsfHeader);
-    }
-
-    public void getDataOffset() {
-        Assert.assertEquals(TestParameters.VP_DATA_OFFSET_LENGTH,
-                chmItsfHeader.getDataOffset());
-    }
-
-    public void getDir_uuid() {
-        Assert.assertNotNull(chmItsfHeader.getDir_uuid());
-    }
-
-    public void getDirLen() {
-        Assert.assertEquals(TestParameters.VP_DIRECTORY_LENGTH,
-                chmItsfHeader.getDirLen());
-    }
-
-    public void getDirOffset() {
-        Assert.assertEquals(TestParameters.VP_DIRECTORY_OFFSET,
-                chmItsfHeader.getDirOffset());
-    }
-
-    public void getHeaderLen() {
-        Assert.assertEquals(TestParameters.VP_ITSF_HEADER_LENGTH,
-                chmItsfHeader.getHeaderLen());
-    }
-
-    public void getLangId() {
-        Assert.assertEquals(TestParameters.VP_LANGUAGE_ID,
-                chmItsfHeader.getLangId());
-    }
-
-    public void getLastModified() {
-        Assert.assertEquals(TestParameters.VP_LAST_MODIFIED,
-                chmItsfHeader.getLastModified());
-    }
-
-    public void getUnknown_000c() {
-        Assert.assertEquals(TestParameters.VP_UNKNOWN_000C,
-                chmItsfHeader.getUnknown_000c());
-    }
-
-    public void getUnknownLen() {
-        Assert.assertEquals(TestParameters.VP_UNKNOWN_LEN,
-                chmItsfHeader.getUnknownLen());
-    }
-
-    public void getUnknownOffset() {
-        Assert.assertEquals(TestParameters.VP_UNKNOWN_OFFSET,
-                chmItsfHeader.getUnknownOffset());
-    }
-
-    public void getVersion() {
-        Assert.assertEquals(TestParameters.VP_VERSION,
-                chmItsfHeader.getVersion());
-    }
-
-    public void testToString() {
-        Assert.assertTrue(chmItsfHeader.toString().contains(
-                TestParameters.VP_ISTF_SIGNATURE));
-    }
-
-    public void tearDown() throws Exception {
-        chmItsfHeader = null;
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.parser.chm;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tika.parser.chm.accessor.ChmItsfHeader;
+import org.apache.tika.parser.chm.core.ChmCommons;
+import org.apache.tika.parser.chm.core.ChmConstants;
+
+/**
+ * Tests all public functions of ChmItsfHeader
+ * 
+ */
+public class TestChmItsfHeader extends TestCase {
+    private ChmItsfHeader chmItsfHeader = null;
+
+    public void setUp() throws Exception {
+        chmItsfHeader = new ChmItsfHeader();
+        byte[] data = TestParameters.chmData;
+        // chmItsfHeader.parse(Arrays.copyOfRange(data, 0,
+        // ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsfHeader);
+        chmItsfHeader.parse(ChmCommons.copyOfRange(data, 0,
+                ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsfHeader);
+    }
+
+    public void getDataOffset() {
+        Assert.assertEquals(TestParameters.VP_DATA_OFFSET_LENGTH,
+                chmItsfHeader.getDataOffset());
+    }
+
+    public void getDir_uuid() {
+        Assert.assertNotNull(chmItsfHeader.getDir_uuid());
+    }
+
+    public void getDirLen() {
+        Assert.assertEquals(TestParameters.VP_DIRECTORY_LENGTH,
+                chmItsfHeader.getDirLen());
+    }
+
+    public void getDirOffset() {
+        Assert.assertEquals(TestParameters.VP_DIRECTORY_OFFSET,
+                chmItsfHeader.getDirOffset());
+    }
+
+    public void getHeaderLen() {
+        Assert.assertEquals(TestParameters.VP_ITSF_HEADER_LENGTH,
+                chmItsfHeader.getHeaderLen());
+    }
+
+    public void getLangId() {
+        Assert.assertEquals(TestParameters.VP_LANGUAGE_ID,
+                chmItsfHeader.getLangId());
+    }
+
+    public void getLastModified() {
+        Assert.assertEquals(TestParameters.VP_LAST_MODIFIED,
+                chmItsfHeader.getLastModified());
+    }
+
+    public void getUnknown_000c() {
+        Assert.assertEquals(TestParameters.VP_UNKNOWN_000C,
+                chmItsfHeader.getUnknown_000c());
+    }
+
+    public void getUnknownLen() {
+        Assert.assertEquals(TestParameters.VP_UNKNOWN_LEN,
+                chmItsfHeader.getUnknownLen());
+    }
+
+    public void getUnknownOffset() {
+        Assert.assertEquals(TestParameters.VP_UNKNOWN_OFFSET,
+                chmItsfHeader.getUnknownOffset());
+    }
+
+    public void getVersion() {
+        Assert.assertEquals(TestParameters.VP_VERSION,
+                chmItsfHeader.getVersion());
+    }
+
+    public void testToString() {
+        Assert.assertTrue(chmItsfHeader.toString().contains(
+                TestParameters.VP_ISTF_SIGNATURE));
+    }
+
+    public void tearDown() throws Exception {
+        chmItsfHeader = null;
+    }
+}

Propchange: tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/chm/TestChmItsfHeader.java
------------------------------------------------------------------------------
    svn:eol-style = native