writeString(fieldNumber, STRING.deser(value, offset ,length), repeated); return;
public String readString() throws IOException { final int length = readRawVarint32(); if(length < 0) throw ProtobufException.negativeSize(); if(offset + length > limit) throw ProtobufException.misreportedSize(); if(length == 0) return ByteString.EMPTY_STRING; final int offset = this.offset; this.offset += length; return STRING.deser(buffer, offset, length); }
public String readString() throws IOException { final int length = readRawVarint32(); if(length < 0) throw ProtobufException.negativeSize(); if(offset + length > limit) throw ProtobufException.misreportedSize(); final int offset = this.offset; this.offset += length; return STRING.deser(buffer, offset, length); }
/** Read a {@code string} field value from the stream. */ public String readString() throws IOException { final int size = readRawVarint32(); if (size <= (bufferSize - bufferPos) && size > 0) { // Fast path: We already have the bytes in a contiguous buffer, so // just copy directly from it. final String result = STRING.deser(buffer, bufferPos, size); bufferPos += size; return result; } else { // Slow path: Build a byte array first then copy it. return STRING.deser(readRawBytes(size)); } }
public void writeByteRange(boolean utf8String, int fieldNumber, byte[] value, int offset, int length, boolean repeated) throws IOException { if(utf8String) { writeString(fieldNumber, STRING.deser(value, offset, length), repeated); } else { writeB64Encoded(writer, schema.getFieldName(fieldNumber), length == 0 ? EMPTY : B64Code.cencode(value, offset, length)); } }