Examples of RunCodec


Examples of org.apache.harmony.pack200.RunCodec

                2, 1, 0, 2, 2, 2, 1, 1, 0, 2, 0, 1, 1, 0, 0 }, new int[] { 5,
                3, 999, 789, 355, 12345 });
        byte[] bandEncoded = new byte[bytes1.length + bytes2.length];
        System.arraycopy(bytes1, 0, bandEncoded, 0, bytes1.length);
        System.arraycopy(bytes2, 0, bandEncoded, bytes1.length, bytes2.length);
        RunCodec runCodec = new RunCodec(5, Codec.DELTA5, new PopulationCodec(
                Codec.UNSIGNED5, Codec.BYTE1, Codec.UNSIGNED5));
        int[] bandDecoded = runCodec.decodeInts(band.length,
                new ByteArrayInputStream(bandEncoded));
        assertEquals(band.length, bandDecoded.length);
        for (int i = 0; i < band.length; i++) {
            assertEquals(band[i], bandDecoded[i]);
        }
View Full Code Here

Examples of org.apache.harmony.pack200.RunCodec

                + bytes3.length];
        System.arraycopy(bytes1, 0, bandEncoded, 0, bytes1.length);
        System.arraycopy(bytes2, 0, bandEncoded, bytes1.length, bytes2.length);
        System.arraycopy(bytes3, 0, bandEncoded, bytes1.length + bytes2.length,
                bytes3.length);
        RunCodec runCodec = new RunCodec(3, Codec.UDELTA5, new RunCodec(3,
                Codec.BYTE1, Codec.UNSIGNED5));
        int[] bandDecoded = runCodec.decodeInts(9, new ByteArrayInputStream(
                bandEncoded));
        assertEquals(band.length, bandDecoded.length);
        for (int i = 0; i < band.length; i++) {
            assertEquals(band[i], bandDecoded[i]);
        }
View Full Code Here

Examples of org.apache.harmony.pack200.RunCodec

            assertEquals(band[i], bandDecoded[i]);
        }
    }

    public void testToString() throws Pack200Exception {
        RunCodec runCodec = new RunCodec(3, Codec.UNSIGNED5, Codec.BYTE1);
        assertEquals(
                "RunCodec[k=" + 3 + ";aCodec=" + Codec.UNSIGNED5.toString()
                        + "bCodec=" + Codec.BYTE1.toString() + "]",
                runCodec.toString());
    }
View Full Code Here

Examples of org.apache.harmony.pack200.RunCodec

                runCodec.toString());
    }

    public void testEncodeSingleValue() {
        try {
            new RunCodec(10, BHSDCodec.SIGNED5, BHSDCodec.UDELTA5).encode(5);
            fail("Should not allow a single value to be encoded as we don't know which codec to use");
        } catch (Pack200Exception e) {
            // pass
        }
        try {
            new RunCodec(10, BHSDCodec.SIGNED5, BHSDCodec.UDELTA5).encode(5, 8);
            fail("Should not allow a single value to be encoded as we don't know which codec to use");
        } catch (Pack200Exception e) {
            // pass
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.