/** * Read a byte[] of a known length from the wire. */ private byte[] readBinary(int length) throws TException { if (length == 0) return new byte[0]; byte[] buf = new byte[length]; trans_.readAll(buf, 0, length); return buf; }
protected byte read() throws TException { if (hasData_) { hasData_ = false; } else { trans_.readAll(data_, 0, 1); } return data_[0]; }
protected byte peek() throws TException { if (!hasData_) { trans_.readAll(data_, 0, 1); } hasData_ = true; return data_[0]; } }
protected byte read() throws TException { if (hasData_) { hasData_ = false; } else { trans_.readAll(data_, 0, 1); } return data_[0]; }
/** * Read a byte[] of a known length from the wire. */ private byte[] readBinary(int length) throws TException { if (length == 0) return new byte[0]; byte[] buf = new byte[length]; trans_.readAll(buf, 0, length); return buf; }
protected byte peek() throws TException { if (!hasData_) { trans_.readAll(data_, 0, 1); } hasData_ = true; return data_[0]; } }
private int readAll(byte[] buf, int off, int len) throws TException { return trans_.readAll(buf, off, len); } }
/** * No magic here - just read a double off the wire. */ public double readDouble() throws TException { byte[] longBits = new byte[8]; trans_.readAll(longBits, 0, 8); return Double.longBitsToDouble(bytesToLong(longBits)); }
public String readStringBody(int size) throws TException { try { byte[] buf = new byte[size]; trans_.readAll(buf, 0, size); return new String(buf, "UTF-8"); } catch (UnsupportedEncodingException uex) { throw new TException("JVM DOES NOT SUPPORT UTF-8"); } }
public String readStringBody(int size) throws TException { try { byte[] buf = new byte[size]; trans_.readAll(buf, 0, size); return new String(buf, "UTF-8"); } catch (UnsupportedEncodingException uex) { throw new TException("JVM DOES NOT SUPPORT UTF-8"); } }
/** * No magic here - just read a double off the wire. */ public double readDouble() throws TException { byte[] longBits = new byte[8]; trans_.readAll(longBits, 0, 8); return Double.longBitsToDouble(bytesToLong(longBits)); }
/** * Read a byte[] from the wire. */ public ByteBuffer readBinary() throws TException { int length = readVarint32(); checkReadLength(length); if (length == 0) return ByteBuffer.wrap(new byte[0]); byte[] buf = new byte[length]; trans_.readAll(buf, 0, length); return ByteBuffer.wrap(buf); }
/** * Read a byte[] from the wire. */ public ByteBuffer readBinary() throws TException { int length = readVarint32(); checkReadLength(length); if (length == 0) return ByteBuffer.wrap(new byte[0]); byte[] buf = new byte[length]; trans_.readAll(buf, 0, length); return ByteBuffer.wrap(buf); }
public void fill(TTransport inTrans, int length) throws TTransportException { buf.resizeIfNecessary(length); inTrans.readAll(buf.array(), 0, length); pos = 0; limit = length; }
private void readFrame() throws TTransportException { transport_.readAll(i32buf, 0, 4); int size = decodeFrameSize(i32buf); if (size < 0) { throw new TTransportException("Read a negative frame size (" + size + ")!"); } if (size > maxLength_) { throw new TTransportException("Frame size (" + size + ") larger than max length (" + maxLength_ + ")!"); } byte[] buff = new byte[size]; transport_.readAll(buff, 0, size); readBuffer_.reset(buff); }
public void fill(TTransport inTrans, int length) throws TTransportException { buf.resizeIfNecessary(length); inTrans.readAll(buf.array(), 0, length); pos = 0; limit = length; }
public ByteBuffer readBinary() throws TException { int size = readI32(); 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(); 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); }
private void readFrame() throws TTransportException { underlying.readAll(i32buf , 0, 4); int size = TFramedTransport.decodeFrameSize(i32buf); if (size < 0) { throw new TTransportException("Read a negative frame size (" + size + ")!"); } if (size > maxLength) { throw new TTransportException("Frame size (" + size + ") larger than max length (" + maxLength + ")!"); } readBuffer.fill(underlying, size); }
private void readFrame() throws TTransportException { underlying.readAll(i32buf , 0, 4); int size = TFramedTransport.decodeFrameSize(i32buf); if (size < 0) { throw new TTransportException("Read a negative frame size (" + size + ")!"); } if (size > maxLength) { throw new TTransportException("Frame size (" + size + ") larger than max length (" + maxLength + ")!"); } readBuffer.fill(underlying, size); }