public synchronized void write (Connection connection, ByteBuffer buffer, Object object) { output.setBuffer(buffer); kryo.getContext().put("connection", connection); kryo.writeClassAndObject(output, object); output.flush(); }
/** Creates a new Output for writing to a ByteBuffer. * @param maxBufferSize The buffer is doubled as needed until it exceeds maxCapacity and an exception is thrown. */ public ByteBufferOutput (ByteBuffer buffer, int maxBufferSize) { setBuffer(buffer, maxBufferSize); }
/** Creates a new Output for writing to a ByteBuffer. * @param maxBufferSize The buffer is doubled as needed until it exceeds maxCapacity and an exception is thrown. */ public ByteBufferOutput (ByteBuffer buffer, int maxBufferSize) { setBuffer(buffer, maxBufferSize); }
/** Creates a new Output for writing to a ByteBuffer. * @param maxBufferSize The buffer is doubled as needed until it exceeds maxCapacity and an exception is thrown. */ public ByteBufferOutput (ByteBuffer buffer, int maxBufferSize) { setBuffer(buffer, maxBufferSize); }
/** Creates a new Output for writing to a ByteBuffer. */ public ByteBufferOutput (ByteBuffer buffer) { setBuffer(buffer); }
/** Creates a new Output for writing to a ByteBuffer. */ public ByteBufferOutput (ByteBuffer buffer) { setBuffer(buffer); }
/** Creates a new Output for writing to a ByteBuffer. */ public ByteBufferOutput (ByteBuffer buffer) { setBuffer(buffer); }
/** Sets the buffer that will be written to. maxCapacity is set to the specified buffer's capacity. * @see #setBuffer(ByteBuffer, int) */ public void setBuffer (ByteBuffer buffer) { setBuffer(buffer, buffer.capacity()); }
/** Sets the buffer that will be written to. maxCapacity is set to the specified buffer's capacity. * @see #setBuffer(ByteBuffer, int) */ public void setBuffer (ByteBuffer buffer) { setBuffer(buffer, buffer.capacity()); }
/** Sets the buffer that will be written to. maxCapacity is set to the specified buffer's capacity. * @see #setBuffer(ByteBuffer, int) */ public void setBuffer (ByteBuffer buffer) { setBuffer(buffer, buffer.capacity()); }
/** Creates a new Output for reading from a byte array. * @param buffer An exception is thrown if more bytes than this are read. */ public ByteBufferOutput (ByteBuffer buffer, int offset, int count) { ByteBuffer newBuffer = buffer.duplicate(); newBuffer.limit(count); newBuffer.rewind(); setBuffer(newBuffer, count); buffer.order(byteOrder); }
public void setBuffer (ByteBuffer buffer, int maxBufferSize) { super.setBuffer(buffer, maxBufferSize); updateBufferAddress(); }
public void setBuffer (ByteBuffer buffer, int maxBufferSize) { super.setBuffer(buffer, maxBufferSize); updateBufferAddress(); }
public void setBuffer (ByteBuffer buffer, int maxBufferSize) { super.setBuffer(buffer, maxBufferSize); updateBufferAddress(); }
public void setBuffer (ByteBuffer buffer, int maxBufferSize) { super.setBuffer(buffer, maxBufferSize); updateBufferAddress(); }
/** Creates a direct ByteBuffer of a given size at a given address. * <p> * Typical usage could look like this snippet: * * <pre> * // Explicitly allocate memory * long bufAddress = UnsafeUtil.unsafe().allocateMemory(4096); * // Create a ByteBufferOutput using the allocated memory region * ByteBufferOutput buffer = new ByteBufferOutput(bufAddress, 4096); * * // Do some operations on this buffer here * * // Say that ByteBuffer won't be used anymore * buffer.release(); * // Release the allocated region * UnsafeUtil.unsafe().freeMemory(bufAddress); * </pre> * * @param address starting address of a memory region pre-allocated using Unsafe.allocateMemory() * @param maxBufferSize */ public ByteBufferOutput (long address, int maxBufferSize) { niobuffer = UnsafeUtil.getDirectBufferAt(address, maxBufferSize); setBuffer(niobuffer, maxBufferSize); }
/** Creates a direct ByteBuffer of a given size at a given address. * <p> * Typical usage could look like this snippet: * * <pre> * // Explicitly allocate memory * long bufAddress = UnsafeUtil.unsafe().allocateMemory(4096); * // Create a ByteBufferOutput using the allocated memory region * ByteBufferOutput buffer = new ByteBufferOutput(bufAddress, 4096); * * // Do some operations on this buffer here * * // Say that ByteBuffer won't be used anymore * buffer.release(); * // Release the allocated region * UnsafeUtil.unsafe().freeMemory(bufAddress); * </pre> * @param address starting address of a memory region pre-allocated using Unsafe.allocateMemory() * @param maxBufferSize */ public ByteBufferOutput (long address, int maxBufferSize) { niobuffer = UnsafeUtil.getDirectBufferAt(address, maxBufferSize); setBuffer(niobuffer, maxBufferSize); }
/** Creates a direct ByteBuffer of a given size at a given address. * <p> * Typical usage could look like this snippet: * * <pre> * // Explicitly allocate memory * long bufAddress = UnsafeUtil.unsafe().allocateMemory(4096); * // Create a ByteBufferOutput using the allocated memory region * ByteBufferOutput buffer = new ByteBufferOutput(bufAddress, 4096); * * // Do some operations on this buffer here * * // Say that ByteBuffer won't be used anymore * buffer.release(); * // Release the allocated region * UnsafeUtil.unsafe().freeMemory(bufAddress); * </pre> * * @param address starting address of a memory region pre-allocated using Unsafe.allocateMemory() * @param maxBufferSize */ public ByteBufferOutput (long address, int maxBufferSize) { niobuffer = UnsafeUtil.getDirectBufferAt(address, maxBufferSize); setBuffer(niobuffer, maxBufferSize); }
/*** This constructor allows for creation of a direct ByteBuffer of a given size at a given address. * * <p> * Typical usage could look like this snippet: * * <pre> * // Explicitly allocate memory * long bufAddress = UnsafeUtil.unsafe().allocateMemory(4096); * // Create a ByteBufferOutput using the allocated memory region * ByteBufferOutput buffer = new ByteBufferOutput(bufAddress, 4096); * * // Do some operations on this buffer here * * // Say that ByteBuffer won't be used anymore * buffer.release(); * // Release the allocated region * UnsafeUtil.unsafe().freeMemory(bufAddress); * </pre> * * @param address starting address of a memory region pre-allocated using Unsafe.allocateMemory() * @param maxBufferSize */ public ByteBufferOutput (long address, int maxBufferSize) { niobuffer = UnsafeUtil.getDirectBufferAt(address, maxBufferSize); setBuffer(niobuffer, maxBufferSize); }
public synchronized void write (Connection connection, ByteBuffer buffer, Object object) { output.setBuffer(buffer); kryo.getContext().put("connection", connection); kryo.writeClassAndObject(output, object); output.flush(); }