private void finishElement() { final Field current = stack.peek(); if (current.type == STRUCT) { current.fieldIndex++; if (current.fieldIndex == current.fieldCount) { // Write back the final NULL byte before the last fields. output.writeByte(current.nullOffset, current.nullByte); } } }
private void beginElement() { final Field current = stack.peek(); if (current.type == STRUCT) { // Every 8 fields we write a NULL byte. if ((current.fieldIndex % 8) == 0) { if (current.fieldIndex > 0) { // Write back previous 8 field's NULL byte. output.writeByte(current.nullOffset, current.nullByte); current.nullByte = 0; current.nullOffset = output.getLength(); } // Allocate next NULL byte. output.reserve(1); } // Set bit in NULL byte when a field is NOT NULL. current.nullByte |= 1 << (current.fieldIndex % 8); } }
@Override public void writeNull() throws IOException { final Field current = stack.peek(); if (current.type == STRUCT) { // Every 8 fields we write a NULL byte. if ((current.fieldIndex % 8) == 0) { if (current.fieldIndex > 0) { // Write back previous 8 field's NULL byte. output.writeByte(current.nullOffset, current.nullByte); current.nullByte = 0; current.nullOffset = output.getLength(); } // Allocate next NULL byte. output.reserve(1); } // We DO NOT set a bit in the NULL byte when we are writing a NULL. current.fieldIndex++; if (current.fieldIndex == current.fieldCount) { // Write back the final NULL byte before the last fields. output.writeByte(current.nullOffset, current.nullByte); } } }
@Override public void writeDate(Date date) throws IOException { // Every 8 fields we write a NULL byte. if ((fieldIndex % 8) == 0) { if (fieldIndex > 0) { // Write back previous 8 field's NULL byte. output.writeByte(nullOffset, nullByte); nullByte = 0; nullOffset = output.getLength(); } // Allocate next NULL byte. output.reserve(1); } // Set bit in NULL byte when a field is NOT NULL. nullByte |= 1 << (fieldIndex % 8); LazyBinaryUtils.writeVInt(output, DateWritable.dateToDays(date)); fieldIndex++; if (fieldIndex == fieldCount) { // Write back the final NULL byte before the last fields. output.writeByte(nullOffset, nullByte); } }
@Override public void writeBoolean(boolean v) throws IOException { // Every 8 fields we write a NULL byte. if ((fieldIndex % 8) == 0) { if (fieldIndex > 0) { // Write back previous 8 field's NULL byte. output.writeByte(nullOffset, nullByte); nullByte = 0; nullOffset = output.getLength(); } // Allocate next NULL byte. output.reserve(1); } // Set bit in NULL byte when a field is NOT NULL. nullByte |= 1 << (fieldIndex % 8); output.write((byte) (v ? 1 : 0)); fieldIndex++; if (fieldIndex == fieldCount) { // Write back the final NULL byte before the last fields. output.writeByte(nullOffset, nullByte); } }
@Override public void writeDate(int dateAsDays) throws IOException { // Every 8 fields we write a NULL byte. if ((fieldIndex % 8) == 0) { if (fieldIndex > 0) { // Write back previous 8 field's NULL byte. output.writeByte(nullOffset, nullByte); nullByte = 0; nullOffset = output.getLength(); } // Allocate next NULL byte. output.reserve(1); } // Set bit in NULL byte when a field is NOT NULL. nullByte |= 1 << (fieldIndex % 8); LazyBinaryUtils.writeVInt(output, dateAsDays); fieldIndex++; if (fieldIndex == fieldCount) { // Write back the final NULL byte before the last fields. output.writeByte(nullOffset, nullByte); } }
@Override public void writeDouble(double v) throws IOException { // Every 8 fields we write a NULL byte. if ((fieldIndex % 8) == 0) { if (fieldIndex > 0) { // Write back previous 8 field's NULL byte. output.writeByte(nullOffset, nullByte); nullByte = 0; nullOffset = output.getLength(); } // Allocate next NULL byte. output.reserve(1); } // Set bit in NULL byte when a field is NOT NULL. nullByte |= 1 << (fieldIndex % 8); LazyBinaryUtils.writeDouble(output, v); fieldIndex++; if (fieldIndex == fieldCount) { // Write back the final NULL byte before the last fields. output.writeByte(nullOffset, nullByte); } }
@Override public void writeLong(long v) throws IOException { // Every 8 fields we write a NULL byte. if ((fieldIndex % 8) == 0) { if (fieldIndex > 0) { // Write back previous 8 field's NULL byte. output.writeByte(nullOffset, nullByte); nullByte = 0; nullOffset = output.getLength(); } // Allocate next NULL byte. output.reserve(1); } // Set bit in NULL byte when a field is NOT NULL. nullByte |= 1 << (fieldIndex % 8); LazyBinaryUtils.writeVLong(output, v); fieldIndex++; if (fieldIndex == fieldCount) { // Write back the final NULL byte before the last fields. output.writeByte(nullOffset, nullByte); } }
@Override public void writeByte(byte v) throws IOException { // Every 8 fields we write a NULL byte. if ((fieldIndex % 8) == 0) { if (fieldIndex > 0) { // Write back previous 8 field's NULL byte. output.writeByte(nullOffset, nullByte); nullByte = 0; nullOffset = output.getLength(); } // Allocate next NULL byte. output.reserve(1); } // Set bit in NULL byte when a field is NOT NULL. nullByte |= 1 << (fieldIndex % 8); output.write(v); fieldIndex++; if (fieldIndex == fieldCount) { // Write back the final NULL byte before the last fields. output.writeByte(nullOffset, nullByte); } }
@Override public void writeDate(Date date) throws IOException { // Every 8 fields we write a NULL byte. if ((fieldIndex % 8) == 0) { if (fieldIndex > 0) { // Write back previous 8 field's NULL byte. output.writeByte(nullOffset, nullByte); nullByte = 0; nullOffset = output.getLength(); } // Allocate next NULL byte. output.reserve(1); } // Set bit in NULL byte when a field is NOT NULL. nullByte |= 1 << (fieldIndex % 8); LazyBinaryUtils.writeVInt(output, DateWritable.dateToDays(date)); fieldIndex++; if (fieldIndex == fieldCount) { // Write back the final NULL byte before the last fields. output.writeByte(nullOffset, nullByte); } }
@Override public void writeDouble(double v) throws IOException { // Every 8 fields we write a NULL byte. if ((fieldIndex % 8) == 0) { if (fieldIndex > 0) { // Write back previous 8 field's NULL byte. output.writeByte(nullOffset, nullByte); nullByte = 0; nullOffset = output.getLength(); } // Allocate next NULL byte. output.reserve(1); } // Set bit in NULL byte when a field is NOT NULL. nullByte |= 1 << (fieldIndex % 8); LazyBinaryUtils.writeDouble(output, v); fieldIndex++; if (fieldIndex == fieldCount) { // Write back the final NULL byte before the last fields. output.writeByte(nullOffset, nullByte); } }
@Override public void writeString(byte[] v, int start, int length) throws IOException { // Every 8 fields we write a NULL byte. if ((fieldIndex % 8) == 0) { if (fieldIndex > 0) { // Write back previous 8 field's NULL byte. output.writeByte(nullOffset, nullByte); nullByte = 0; nullOffset = output.getLength(); } // Allocate next NULL byte. output.reserve(1); } // Set bit in NULL byte when a field is NOT NULL. nullByte |= 1 << (fieldIndex % 8); LazyBinaryUtils.writeVInt(output, length); output.write(v, start, length); fieldIndex++; if (fieldIndex == fieldCount) { // Write back the final NULL byte before the last fields. output.writeByte(nullOffset, nullByte); } }
@Override public void writeInt(int v) throws IOException { // Every 8 fields we write a NULL byte. if ((fieldIndex % 8) == 0) { if (fieldIndex > 0) { // Write back previous 8 field's NULL byte. output.writeByte(nullOffset, nullByte); nullByte = 0; nullOffset = output.getLength(); } // Allocate next NULL byte. output.reserve(1); } // Set bit in NULL byte when a field is NOT NULL. nullByte |= 1 << (fieldIndex % 8); LazyBinaryUtils.writeVInt(output, v); fieldIndex++; if (fieldIndex == fieldCount) { // Write back the final NULL byte before the last fields. output.writeByte(nullOffset, nullByte); } }
@Override public void writeNull() throws IOException { // Every 8 fields we write a NULL byte. if ((fieldIndex % 8) == 0) { if (fieldIndex > 0) { // Write back previous 8 field's NULL byte. output.writeByte(nullOffset, nullByte); nullByte = 0; nullOffset = output.getLength(); } // Allocate next NULL byte. output.reserve(1); } // We DO NOT set a bit in the NULL byte when we are writing a NULL. fieldIndex++; if (fieldIndex == fieldCount) { // Write back the final NULL byte before the last fields. output.writeByte(nullOffset, nullByte); } }
@Override public void writeByte(byte v) throws IOException { // Every 8 fields we write a NULL byte. if ((fieldIndex % 8) == 0) { if (fieldIndex > 0) { // Write back previous 8 field's NULL byte. output.writeByte(nullOffset, nullByte); nullByte = 0; nullOffset = output.getLength(); } // Allocate next NULL byte. output.reserve(1); } // Set bit in NULL byte when a field is NOT NULL. nullByte |= 1 << (fieldIndex % 8); output.write(v); fieldIndex++; if (fieldIndex == fieldCount) { // Write back the final NULL byte before the last fields. output.writeByte(nullOffset, nullByte); } }
@Override public void writeBoolean(boolean v) throws IOException { // Every 8 fields we write a NULL byte. if ((fieldIndex % 8) == 0) { if (fieldIndex > 0) { // Write back previous 8 field's NULL byte. output.writeByte(nullOffset, nullByte); nullByte = 0; nullOffset = output.getLength(); } // Allocate next NULL byte. output.reserve(1); } // Set bit in NULL byte when a field is NOT NULL. nullByte |= 1 << (fieldIndex % 8); output.write((byte) (v ? 1 : 0)); fieldIndex++; if (fieldIndex == fieldCount) { // Write back the final NULL byte before the last fields. output.writeByte(nullOffset, nullByte); } }
@Override public void writeNull() throws IOException { // Every 8 fields we write a NULL byte. if ((fieldIndex % 8) == 0) { if (fieldIndex > 0) { // Write back previous 8 field's NULL byte. output.writeByte(nullOffset, nullByte); nullByte = 0; nullOffset = output.getLength(); } // Allocate next NULL byte. output.reserve(1); } // We DO NOT set a bit in the NULL byte when we are writing a NULL. fieldIndex++; if (fieldIndex == fieldCount) { // Write back the final NULL byte before the last fields. output.writeByte(nullOffset, nullByte); } }
@Override public void writeNull() throws IOException { // Every 8 fields we write a NULL byte. if ((fieldIndex % 8) == 0) { if (fieldIndex > 0) { // Write back previous 8 field's NULL byte. output.writeByte(nullOffset, nullByte); nullByte = 0; nullOffset = output.getLength(); } // Allocate next NULL byte. output.reserve(1); } // We DO NOT set a bit in the NULL byte when we are writing a NULL. fieldIndex++; if (fieldIndex == fieldCount) { // Write back the final NULL byte before the last fields. output.writeByte(nullOffset, nullByte); } }
private void beginElement() { final Field current = stack.peek(); if (current.type == STRUCT) { // Every 8 fields we write a NULL byte. if ((current.fieldIndex % 8) == 0) { if (current.fieldIndex > 0) { // Write back previous 8 field's NULL byte. output.writeByte(current.nullOffset, current.nullByte); current.nullByte = 0; current.nullOffset = output.getLength(); } // Allocate next NULL byte. output.reserve(1); } // Set bit in NULL byte when a field is NOT NULL. current.nullByte |= 1 << (current.fieldIndex % 8); } }
private void finishElement() { final Field current = stack.peek(); if (current.type == STRUCT) { current.fieldIndex++; if (current.fieldIndex == current.fieldCount) { // Write back the final NULL byte before the last fields. output.writeByte(current.nullOffset, current.nullByte); } } }