public void clear() { super.clear(); encodedForm = null; decoded = true; }
@SuppressWarnings("unchecked") public T assertInitialized() throws UninitializedMessageException { java.util.ArrayList<String> missingFields = missingFields(); if (!missingFields.isEmpty()) { throw new UninitializedMessageException(missingFields); } return getThis(); }
public ArrayList<String> missingFields() { load(); return new ArrayList<String>(); }
public T mergeUnframed(InputStream input) throws IOException { CodedInputStream codedInput = new CodedInputStream(input); mergeUnframed(codedInput); return getThis(); }
public T mergeFramed(InputStream input) throws IOException { int length = readRawVarint32(input); byte[] data = new byte[length]; int pos = 0; while (pos < length) { int r = input.read(data, pos, length - pos); if (r < 0) { throw new InvalidProtocolBufferException("Input stream ended before a full message frame could be read."); } pos += r; } return mergeUnframed(data); }
public T mergeFramed(Buffer data) throws InvalidProtocolBufferException { try { CodedInputStream input = new CodedInputStream(data); mergeFramed(input); input.checkLastTagWas(0); return getThis(); } catch (InvalidProtocolBufferException e) { throw e; } catch (IOException e) { throw new RuntimeException("An IOException was thrown (should never happen in this method).", e); } }
public Buffer toFramedBuffer() { try { int size = serializedSizeFramed(); BufferOutputStream baos = new BufferOutputStream(size); CodedOutputStream output = new CodedOutputStream(baos); writeFramed(output); Buffer rc = baos.toBuffer(); if( rc.length != size ) { throw new IllegalStateException("Did not write as much data as expected."); } return rc; } catch (IOException e) { throw new RuntimeException("Serializing to a byte array threw an IOException " + "(should never happen).", e); } }
public T mergeUnframed(byte[] data) throws InvalidProtocolBufferException { return mergeUnframed(new Buffer(data)); }
protected void loadAndClear() { super.loadAndClear(); load(); encodedForm = null; }
@SuppressWarnings("unchecked") public T mergeFrom(T other) { return getThis(); }
public T mergeFramed(byte[] data) throws InvalidProtocolBufferException { return mergeFramed(new Buffer(data)); }
public boolean isInitialized() { return missingFields().isEmpty(); }
static protected int computeMessageSize(int tag, BaseMessage message) { return CodedOutputStream.computeTagSize(tag) + message.serializedSizeFramed(); }
byte tmp = readRawByte(is); if (tmp >= 0) { return tmp; if ((tmp = readRawByte(is)) >= 0) { result |= tmp << 7; } else { result |= (tmp & 0x7f) << 7; if ((tmp = readRawByte(is)) >= 0) { result |= tmp << 14; } else { result |= (tmp & 0x7f) << 14; if ((tmp = readRawByte(is)) >= 0) { result |= tmp << 21; } else { result |= (tmp & 0x7f) << 21; result |= (tmp = readRawByte(is)) << 28; if (tmp < 0) { if (readRawByte(is) >= 0) return result;
public T mergeUnframed(InputStream input) throws IOException { CodedInputStream codedInput = new CodedInputStream(input); mergeUnframed(codedInput); return getThis(); }
public T mergeFramed(Buffer data) throws InvalidProtocolBufferException { try { CodedInputStream input = new CodedInputStream(data); mergeFramed(input); input.checkLastTagWas(0); return getThis(); } catch (InvalidProtocolBufferException e) { throw e; } catch (IOException e) { throw new RuntimeException("An IOException was thrown (should never happen in this method).", e); } }
public T mergeFramed(InputStream input) throws IOException { int length = readRawVarint32(input); byte[] data = new byte[length]; int pos = 0; while (pos < length) { int r = input.read(data, pos, length - pos); if (r < 0) { throw new InvalidProtocolBufferException("Input stream ended before a full message frame could be read."); } pos += r; } return mergeUnframed(data); }
public Buffer toFramedBuffer() { try { int size = serializedSizeFramed(); BufferOutputStream baos = new BufferOutputStream(size); CodedOutputStream output = new CodedOutputStream(baos); writeFramed(output); Buffer rc = baos.toBuffer(); if( rc.length != size ) { throw new IllegalStateException("Did not write as much data as expected."); } return rc; } catch (IOException e) { throw new RuntimeException("Serializing to a byte array threw an IOException " + "(should never happen).", e); } }
public T mergeUnframed(byte[] data) throws InvalidProtocolBufferException { return mergeUnframed(new Buffer(data)); }
protected void loadAndClear() { super.loadAndClear(); load(); encodedForm = null; }