transport.read(bytes, 0, 4); magic = protocol.readI16(); messageLength = protocol.readI32();
transport.read(bytes, 0, 4); magic = protocol.readI16(); messageLength = protocol.readI32();
/** * Reading methods. */ public TMessage readMessageBegin() throws TException { int size = readI32(); if (size < 0) { int version = size & VERSION_MASK; if (version != VERSION_1) { throw new TProtocolException(TProtocolException.BAD_VERSION, "Bad version in readMessageBegin"); } return new TMessage(readString(), (byte)(size & 0x000000ff), readI32()); } else { if (strictRead_) { throw new TProtocolException(TProtocolException.BAD_VERSION, "Missing version in readMessageBegin, old client?"); } return new TMessage(readStringBody(size), readByte(), readI32()); } }
public TSet readSetBegin() throws TException { TSet set = new TSet(readByte(), readI32()); checkContainerReadLength(set.size); return set; }
public TList readListBegin() throws TException { TList list = new TList(readByte(), readI32()); checkContainerReadLength(list.size); return list; }
public ByteBuffer readBinary() throws TException { int size = readI32(); checkStringReadLength(size); if (trans_.getBytesRemainingInBuffer() >= size) { ByteBuffer bb = ByteBuffer.wrap(trans_.getBuffer(), trans_.getBufferPosition(), size); trans_.consumeBuffer(size); return bb; } byte[] buf = new byte[size]; trans_.readAll(buf, 0, size); return ByteBuffer.wrap(buf); }
public TMap readMapBegin() throws TException { TMap map = new TMap(readByte(), readByte(), readI32()); checkContainerReadLength(map.size); return map; }
public String readString() throws TException { int size = readI32(); checkStringReadLength(size); if (trans_.getBytesRemainingInBuffer() >= size) { try { String s = new String(trans_.getBuffer(), trans_.getBufferPosition(), size, "UTF-8"); trans_.consumeBuffer(size); return s; } catch (UnsupportedEncodingException e) { throw new TException("JVM DOES NOT SUPPORT UTF-8"); } } return readStringBody(size); }
public String readString() throws TException { int size = readI32(); return readStringBody(size); }
public byte[] readBinary() throws TException { int size = readI32(); checkReadLength(size); byte[] buf = new byte[size]; trans_.readAll(buf, 0, size); return buf; }
public TList readListBegin() throws TException { return new TList(readByte(), readI32()); }
public TSet readSetBegin() throws TException { return new TSet(readByte(), readI32()); }
public TSet readSetBegin() throws TException { return new TSet(readByte(), readI32()); }
static boolean parseResponse(TBinaryProtocol iprot) throws TException { iprot.readStructBegin(); TField schemeField; while ((schemeField = iprot.readFieldBegin()).type != TType.STOP) { if (schemeField.id == 0 /* SUCCESS */ && schemeField.type == TType.I32) { return iprot.readI32() == 0; } else { TProtocolUtil.skip(iprot, schemeField.type); } } throw new TApplicationException(MISSING_RESULT, "Log failed: unknown result"); }
static boolean parseResponse(TBinaryProtocol iprot) throws TException { iprot.readStructBegin(); TField schemeField; while ((schemeField = iprot.readFieldBegin()).type != TType.STOP) { if (schemeField.id == 0 /* SUCCESS */ && schemeField.type == TType.I32) { return iprot.readI32() == 0; } else { TProtocolUtil.skip(iprot, schemeField.type); } } throw new TApplicationException(MISSING_RESULT, "Log failed: unknown result"); }
public TMap readMapBegin() throws TException { return new TMap(readByte(), readByte(), readI32()); }
public TMap readMapBegin() throws TException { return new TMap(readByte(), readByte(), readI32()); }
public ByteBuffer readBinary() throws TException { int size = readI32(); checkReadLength(size); if (trans_.getBytesRemainingInBuffer() >= size) { ByteBuffer bb = ByteBuffer.wrap(trans_.getBuffer(), trans_.getBufferPosition(), size); trans_.consumeBuffer(size); return bb; } byte[] buf = new byte[size]; trans_.readAll(buf, 0, size); return ByteBuffer.wrap(buf); }
public ByteBuffer readBinary() throws TException { int size = readI32(); checkReadLength(size); if (trans_.getBytesRemainingInBuffer() >= size) { ByteBuffer bb = ByteBuffer.wrap(trans_.getBuffer(), trans_.getBufferPosition(), size); trans_.consumeBuffer(size); return bb; } byte[] buf = new byte[size]; trans_.readAll(buf, 0, size); return ByteBuffer.wrap(buf); }
public String readString() throws TException { int size = readI32(); if (trans_.getBytesRemainingInBuffer() >= size) { try { checkReadLength(size); String s = new String(trans_.getBuffer(), trans_.getBufferPosition(), size, "UTF-8"); trans_.consumeBuffer(size); return s; } catch (UnsupportedEncodingException e) { throw new TException("JVM DOES NOT SUPPORT UTF-8"); } } return readStringBody(size); }