internal static java.nio.ByteBuffer makeByteBuffer(int bytes) { java.nio.ByteBuffer result = java.nio.ByteBuffer.prepare(bytes); result.order(java.nio.ByteOrder.LITTLE_ENDIAN); result.mark(); return(result); }
/// <exception cref="System.IO.IOException"/> public virtual void writeBuffer(java.nio.channels.SeekableByteChannel channel) { buffer.mark(); while (buffer.hasRemaining()) { channel.write(buffer); } buffer.reset(); }
/// <summary> /// Resizes the internal buffer, preserving contents if the new size is at least /// as big as the existing present size /// </summary> /// <param name="newSize"> /// number of doubles to hold /// TODO: This moves the backing buffer, if there are any views into /// this matrix then they will no longer point to this matrix and the /// coupling will be lost. Solution: Views should register themselves as /// listeners to buffer changes, e.g. BufferResizeListener /// CAUTION: This function uses a direct memory copy, so this means for /// row-major matrices the number of columns cannot change and vice /// versa. /// </param> protected internal virtual void resizeBuffer(int prevSize, int newSize) { java.nio.ByteBuffer newBuffer = fastmath.BufferUtils.newNativeBuffer(newSize * fastmath.matfile.MiDouble .BYTES); newBuffer.mark(); if (buffer != null) { newBuffer.put(buffer); } newBuffer.reset(); buffer = newBuffer; }