public byte readByte() { assert (hasCapacity(1)); return (byte) read(); }
public void readFully(byte[] b) { readFully(b, 0, b.length); }
public void writeBoolean(boolean v) { assert (hasCapacity(1)); write(v ? 1 : 0); }
@Override public void reset(int nextExpectedReadSize) { // Allocate a new Buffer to hold the incoming frame. We must write // back the frame size value before continue on to read the indicated // frame size minus the size of the AMQP frame size header value. frame = new Buffer(nextExpectedReadSize); frame.bigEndianEditor().writeInt(nextExpectedReadSize); // Reset the length to total length as we do direct write after this. frame.length = frame.data.length; } };
private void storeContent() { try { if (dataOut != null) { dataOut.close(); Buffer bs = bytesOut.toBuffer(); if (compressed) { int pos = bs.offset; bs.offset = 0; BufferEditor e = BufferEditor.big(bs); e.writeInt(length); bs.offset = pos; } setContent(bs); bytesOut = null; dataOut = null; } } catch (IOException ioe) { throw new RuntimeException(ioe.getMessage(), ioe); // TODO verify // RuntimeException } }
public void write(int b) { assert (hasCapacity(1)); buffer.data[buffer.offset++] = (byte) b; buffer.length--; }
/** * Converts a Binary value to a long assuming that the contained value is * stored in Big Endian encoding. * * @param value the Binary object whose payload is converted to a long. * @return a long value constructed from the bytes of the Binary instance. */ public static long toLong(Binary value) { Buffer buffer = new Buffer(value.getArray(), value.getArrayOffset(), value.getLength()); return buffer.bigEndianEditor().readLong(); }
/** * Given a long value, convert it to a byte array for marshalling. * * @param value the value to convert. * @return a new byte array that holds the big endian value of the long. */ public static byte[] toBytes(long value) { Buffer buffer = new Buffer(8); buffer.bigEndianEditor().writeLong(value); return buffer.data; }
public void write(byte[] b) { write(b, 0, b.length); }
@Override public void reset(int nextExpectedReadSize) { // Allocate a new Buffer to hold the incoming frame. We must write // back the frame size value before continue on to read the indicated // frame size minus the size of the AMQP frame size header value. frame = new Buffer(nextExpectedReadSize); frame.bigEndianEditor().writeInt(nextExpectedReadSize); // Reset the length to total length as we do direct write after this. frame.length = frame.data.length; } };
private void storeContent() { try { if (dataOut != null) { dataOut.close(); Buffer bs = bytesOut.toBuffer(); if (compressed) { int pos = bs.offset; bs.offset = 0; BufferEditor e = BufferEditor.big(bs); e.writeInt(length); bs.offset = pos; } setContent(bs); bytesOut = null; dataOut = null; } } catch (IOException ioe) { throw new RuntimeException(ioe.getMessage(), ioe); // TODO verify // RuntimeException } }
public void write(int b) { assert (hasCapacity(1)); buffer.data[buffer.offset++] = (byte) b; buffer.length--; }
/** * Converts a Binary value to a long assuming that the contained value is * stored in Big Endian encoding. * * @param value * the Binary object whose payload is converted to a long. * * @return a long value constructed from the bytes of the Binary instance. */ public static long toLong(Binary value) { Buffer buffer = new Buffer(value.getArray(), value.getArrayOffset(), value.getLength()); return buffer.bigEndianEditor().readLong(); }
/** * Given a long value, convert it to a byte array for marshalling. * * @param value * the value to convert. * * @return a new byte array that holds the big endian value of the long. */ public static byte[] toBytes(long value) { Buffer buffer = new Buffer(8); buffer.bigEndianEditor().writeLong(value); return buffer.data; }
public void write(byte[] b) { write(b, 0, b.length); }
public byte readByte() { assert (hasCapacity(1)); return (byte) read(); }
public void writeByte(int v) { assert (hasCapacity(1)); write(v); }
public void run() { if(holder!=null) holder.factory.unget(); final Buffer command = baos.toBuffer(); // Update the size field. BufferEditor editor = command.buffer().bigEndianEditor(); editor.writeInt(command.length); queue().execute(new Runnable() { public void run() { transport.offer(command); } }); } });
public void write(int b) { assert (hasCapacity(1)); buffer.data[buffer.offset++] = (byte) b; buffer.length--; }