Java Code Examples for co.nstant.in.cbor.model.Array#setChunked()

The following examples show how to use co.nstant.in.cbor.model.Array#setChunked() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArrayDecoder.java    From cbor-java with Apache License 2.0 6 votes vote down vote up
private Array decodeInfinitiveLength() throws CborException {
    Array array = new Array();
    array.setChunked(true);
    if (decoder.isAutoDecodeInfinitiveArrays()) {
        DataItem dataItem;
        for (;;) {
            dataItem = decoder.decodeNext();
            if (dataItem == null) {
                throw new CborException("Unexpected end of stream");
            }
            if (Special.BREAK.equals(dataItem)) {
                array.add(Special.BREAK);
                break;
            }
            array.add(dataItem);
        }
    }
    return array;
}
 
Example 2
Source File: CborBuilder.java    From cbor-java with Apache License 2.0 4 votes vote down vote up
public ArrayBuilder<CborBuilder> startArray() {
    Array array = new Array();
    array.setChunked(true);
    add(array);
    return new ArrayBuilder<CborBuilder>(this, array);
}
 
Example 3
Source File: MapBuilder.java    From cbor-java with Apache License 2.0 4 votes vote down vote up
public ArrayBuilder<MapBuilder<T>> startArray(DataItem key) {
    Array array = new Array();
    array.setChunked(true);
    put(key, array);
    return new ArrayBuilder<>(this, array);
}
 
Example 4
Source File: MapBuilder.java    From cbor-java with Apache License 2.0 4 votes vote down vote up
public ArrayBuilder<MapBuilder<T>> startArray(String key) {
    Array array = new Array();
    array.setChunked(true);
    put(convert(key), array);
    return new ArrayBuilder<>(this, array);
}
 
Example 5
Source File: ArrayBuilder.java    From cbor-java with Apache License 2.0 4 votes vote down vote up
public ArrayBuilder<ArrayBuilder<T>> startArray() {
    Array nestedArray = new Array();
    nestedArray.setChunked(true);
    add(nestedArray);
    return new ArrayBuilder<ArrayBuilder<T>>(this, nestedArray);
}