You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Mohanraj Loganathan <mo...@gmail.com> on 2010/08/13 11:03:51 UTC

[classlib][archive]Deflater.setlevel throws IllegalStateException if inputBuffer is not null

Please consider the below testcase [1] . RI works fine. But Harmony
throws IllegalStateException.  This is the same case with
defl.setStrategy() function also.

Any reason why harmony expects the inputbuffer to be null, while
setLevel and setStrategy ?

Any comments?

[1] public void test () {
        byte[] byteArray = new byte[100];
        InputStream inFile = new FileInputStream(new File("Input.txt"));
                       //input.txt - any text file with some text in it.
        inFile.read(byteArray);
        inFile.close();
        Deflater defl = new Deflater();
        byte[] outPutBuf = new byte[500];
        defl.setInput(byteArray);
        defl.setLevel(2);
        while (!defl.needsInput()) {
            defl.deflate(outPutBuf);
        }
        defl.finish();
        while (!defl.finished()) {
            defl.deflate(outPutBuf);
        }

        int totalOut;
        totalOut = defl.getTotalOut();
        System.out.println("TotalOut=" + totalOut);
}


Thanks and Regards,
Mohan

Re: [classlib][archive]Deflater.setlevel throws IllegalStateException if inputBuffer is not null

Posted by Mohanraj Loganathan <mo...@gmail.com>.
Raised a JIRA for the above issue -->
https://issues.apache.org/jira/browse/HARMONY-6623

Thanks and Regards,
Mohan

On Fri, Aug 13, 2010 at 2:33 PM, Mohanraj Loganathan
<mo...@gmail.com> wrote:
> Please consider the below testcase [1] . RI works fine. But Harmony
> throws IllegalStateException.  This is the same case with
> defl.setStrategy() function also.
>
> Any reason why harmony expects the inputbuffer to be null, while
> setLevel and setStrategy ?
>
> Any comments?
>
> [1] public void test () {
>        byte[] byteArray = new byte[100];
>        InputStream inFile = new FileInputStream(new File("Input.txt"));
>                       //input.txt - any text file with some text in it.
>        inFile.read(byteArray);
>        inFile.close();
>        Deflater defl = new Deflater();
>        byte[] outPutBuf = new byte[500];
>        defl.setInput(byteArray);
>        defl.setLevel(2);
>        while (!defl.needsInput()) {
>            defl.deflate(outPutBuf);
>        }
>        defl.finish();
>        while (!defl.finished()) {
>            defl.deflate(outPutBuf);
>        }
>
>        int totalOut;
>        totalOut = defl.getTotalOut();
>        System.out.println("TotalOut=" + totalOut);
> }
>
>
> Thanks and Regards,
> Mohan
>



-- 
Mohan