Skip to content

Provide way to limit array size for whole stream array read #44

Closed
@slaft

Description

@slaft

Hello

I'm trying to limit the length of arrays created by JBBP.

I was able to do it for JBBP types that way:

public class CustomJBBPBitInputStream extends JBBPBitInputStream {

    public CustomJBBPBitInputStream(InputStream in, JBBPBitOrder order) {
        super(in, order);
    }

    @Override
    public boolean[] readBoolArray(final int items) throws IOException {
        // validation here
        return super.readBoolArray(items);
    }
...
}

// Used like this:
parser.parse(new CustomJBBPBitInputStream(new ByteArrayInputStream(input), bitOrder));

But I couldn't find a way for arrays of structures and arrays without a defined size ([_]).
Do you see a way to do that? Otherwise is a change possible?
(I use the latest version.)

Thanks for your help.

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions