/** * Compute the number of bytes that would be needed to encode a {@code * string} field, including tag. */ public static int computeStringSize(int fieldNumber, String value) { try { byte[] bytes = value.getBytes("UTF-8"); return computeTagSize(fieldNumber) + computeRawVarint32Size(bytes.length) + bytes.length; } catch (java.io.UnsupportedEncodingException e) { throw new RuntimeException("UTF-8 not supported.", e); } }
/** * Compute the number of bytes that would be needed to encode a {@code * uint32} field, including tag. */ public static int computeUInt32Size(int fieldNumber, int value) { return computeTagSize(fieldNumber) + computeRawVarint32Size(value); }
/** * Compute the number of bytes that would be needed to encode a {@code * bytes} field, including tag. */ public static int computeBytesSize(int fieldNumber, Buffer value) { return computeTagSize(fieldNumber) + computeRawVarint32Size(value.length) + value.length; }
public int serializedSizeFramed() { int t = serializedSizeUnframed(); return org.fusesource.hawtbuf.proto.CodedOutputStream.computeRawVarint32Size(t) + t; }
public int serializedSizeFramed() { int t = serializedSizeUnframed(); return org.fusesource.hawtbuf.proto.CodedOutputStream.computeRawVarint32Size(t) + t; }
public int serializedSizeFramed() { int t = serializedSizeUnframed(); return org.fusesource.hawtbuf.proto.CodedOutputStream.computeRawVarint32Size(t) + t; }
public int serializedSizeFramed() { int t = serializedSizeUnframed(); return org.fusesource.hawtbuf.proto.CodedOutputStream.computeRawVarint32Size(t) + t; }
public int serializedSizeFramed() { int t = serializedSizeUnframed(); return org.fusesource.hawtbuf.proto.CodedOutputStream.computeRawVarint32Size(t) + t; }
public int serializedSizeFramed() { int t = serializedSizeUnframed(); return org.fusesource.hawtbuf.proto.CodedOutputStream.computeRawVarint32Size(t) + t; }
/** * Compute the number of bytes that would be needed to encode an enum field, * including tag. Caller is responsible for converting the enum value to its * numeric value. */ public static int computeEnumSize(int fieldNumber, int value) { return computeTagSize(fieldNumber) + computeRawVarint32Size(value); }
public int serializedSizeFramed() { int t = serializedSizeUnframed(); return org.fusesource.hawtbuf.proto.CodedOutputStream.computeRawVarint32Size(t) + t; }
public int serializedSizeFramed() { int t = serializedSizeUnframed(); return org.fusesource.hawtbuf.proto.CodedOutputStream.computeRawVarint32Size(t) + t; }
public int serializedSizeFramed() { int t = serializedSizeUnframed(); return org.fusesource.hawtbuf.proto.CodedOutputStream.computeRawVarint32Size(t) + t; }
public int serializedSizeFramed() { int t = serializedSizeUnframed(); return org.fusesource.hawtbuf.proto.CodedOutputStream.computeRawVarint32Size(t) + t; }
public int serializedSizeFramed() { int t = serializedSizeUnframed(); return org.fusesource.hawtbuf.proto.CodedOutputStream.computeRawVarint32Size(t) + t; }
public int serializedSizeFramed() { int t = serializedSizeUnframed(); return org.fusesource.hawtbuf.proto.CodedOutputStream.computeRawVarint32Size(t) + t; }
public int serializedSizeFramed() { int t = serializedSizeUnframed(); return org.fusesource.hawtbuf.proto.CodedOutputStream.computeRawVarint32Size(t) + t; }
public int serializedSizeFramed() { int t = serializedSizeUnframed(); return org.fusesource.hawtbuf.proto.CodedOutputStream.computeRawVarint32Size(t) + t; }
/** * Compute the number of bytes that would be needed to encode an {@code * int32} field, including tag. */ public static int computeInt32Size(int fieldNumber, int value) { if (value >= 0) { return computeTagSize(fieldNumber) + computeRawVarint32Size(value); } else { // Must sign-extend. return computeTagSize(fieldNumber) + 10; } }
/** * Compute the number of bytes that would be needed to encode an {@code * sint32} field, including tag. */ public static int computeSInt32Size(int fieldNumber, int value) { return computeTagSize(fieldNumber) + computeRawVarint32Size(encodeZigZag32(value)); }