[ 
https://issues.apache.org/jira/browse/DERBY-3770?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Knut Anders Hatlen updated DERBY-3770:
--------------------------------------

    Attachment: derby-3770-remove-1a.diff

The possibly buggy skip methods in CompressedNumber aren't used anywhere in the 
code, except in CompressedNumberTest where the DataInput variants are tested. 
Instead of fixing methods that aren't used, I think it is better to remove 
them. The attached patch (derby-3770-remove-1a.diff) removes all the skip 
methods from CompressedNumber and the test cases for these methods. It also 
removes another unused method, readIntAndReturnIntPlusOverhead().

I have started the regression tests on the patch.

> Create a utility class for skipping data in an InputStream
> ----------------------------------------------------------
>
>                 Key: DERBY-3770
>                 URL: https://issues.apache.org/jira/browse/DERBY-3770
>             Project: Derby
>          Issue Type: Improvement
>          Components: Miscellaneous
>    Affects Versions: 10.5.0.0
>            Reporter: Kristian Waagan
>            Assignee: Junjie Peng
>            Priority: Minor
>         Attachments: derby-3770-1.patch, derby-3770-1.stat, 
> derby-3770-2.patch, derby-3770-2.stat, derby-3770-3.patch, derby-3770-3.stat, 
> derby-3770-4.patch, derby-3770-4.patch, derby-3770-4.stat, derby-3770-4.stat, 
> derby-3770-5.patch, derby-3770-5.stat, derby-3770-6.patch, derby-3770-6.stat, 
> derby-3770-remove-1a.diff, derby-3770-use-1a.diff
>
>
> The contract of InputStream.skip is somewhat difficult, some would even say 
> broken.
> See http://java.sun.com/javase/6/docs/api/java/io/InputStream.html#skip(long))
> A utility class should be created to ensure that we use the same skip 
> procedure throughout the Derby code base.
> Suggested functionality:
>  - long skipFully(InputStream) : skips until EOF, returns number of bytes 
> skipped
>  - void skipFully(InputStream,long) : skips requested number of bytes, throws 
> EOFException if there is too few bytes in the stream
> I know of two different approaches, both skipping in a loop:
>  a) Verify EOF with a read call when skip returns zero.
>  b) Throw EOFException if skip returns zero before requested number of bytes 
> have been skipped.
> There's related code in iapi.util.UTF8Util. Maybe this class, say StreamUtil, 
> could be put in the same package?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to