Java Code Examples for io.airlift.slice.Slice#indexOfByte()

The following examples show how to use io.airlift.slice.Slice#indexOfByte() . 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: StringEncoding.java    From presto with Apache License 2.0 6 votes vote down vote up
@Override
public void encodeColumn(Block block, SliceOutput output, EncodeOutput encodeOutput)
{
    for (int position = 0; position < block.getPositionCount(); position++) {
        if (block.isNull(position)) {
            output.writeBytes(nullSequence);
        }
        else {
            Slice slice = type.getSlice(block, position);
            if (escapeByte != null && slice.indexOfByte(escapeByte) < 0) {
                throw new IllegalArgumentException("escape not implemented");
            }
            output.writeBytes(slice);
        }
        encodeOutput.closeEntry();
    }
}
 
Example 2
Source File: StringEncoding.java    From presto with Apache License 2.0 5 votes vote down vote up
@Override
public void encodeValueInto(int depth, Block block, int position, SliceOutput output)
{
    Slice slice = type.getSlice(block, position);
    if (escapeByte != null && slice.indexOfByte(escapeByte) < 0) {
        throw new IllegalArgumentException("escape not implemented");
    }
    output.writeBytes(slice);
}