APIdia Launch Partner
Top Fields Constructors Methods
java.nio

pack-priv final Class DirectByteBufferR

extends DirectByteBuffer
implements DirectBuffer
Class Inheritance
All Implemented Interfaces
sun.nio.ch.DirectBuffer
Imports
java.io.FileDescriptor, java.lang.foreign.MemorySegment, java.lang.ref.Reference, java.nio.BufferCleaner, java.util.Objects, jdk.internal.foreign.AbstractMemorySegmentImpl, .MemorySessionImpl, .SegmentFactories, jdk.internal.vm.annotation.ForceInline, jdk.internal.misc.ScopedMemoryAccess.ScopedAccessError, .VM, sun.nio.Cleaner, sun.nio.ch.DirectBuffer

Field Summary

Inherited from java.nio.DirectByteBuffer:
UNALIGNED

Constructor Summary

AccessConstructor and Description
pack-priv
protected
DirectByteBufferR(int cap, long addr, FileDescriptor fd, Runnable unmapper, boolean isSync, MemorySegment segment)

pack-priv
DirectByteBufferR(DirectBuffer db, int mark, int pos, int lim, int cap, int off, FileDescriptor fd, boolean isSync, MemorySegment segment)

Method Summary

Modifier and TypeMethod and Description
public CharBuffer
asCharBuffer()

Overrides java.nio.DirectByteBuffer.asCharBuffer.

Creates a view of this byte buffer as a char buffer.

public DoubleBuffer
asDoubleBuffer()

Overrides java.nio.DirectByteBuffer.asDoubleBuffer.

Creates a view of this byte buffer as a double buffer.

public FloatBuffer
asFloatBuffer()

Overrides java.nio.DirectByteBuffer.asFloatBuffer.

Creates a view of this byte buffer as a float buffer.

public IntBuffer
asIntBuffer()

Overrides java.nio.DirectByteBuffer.asIntBuffer.

Creates a view of this byte buffer as an int buffer.

public LongBuffer
asLongBuffer()

Overrides java.nio.DirectByteBuffer.asLongBuffer.

Creates a view of this byte buffer as a long buffer.

public ByteBuffer
asReadOnlyBuffer()

Overrides java.nio.DirectByteBuffer.asReadOnlyBuffer.

Creates a new, read-only byte buffer that shares this buffer's content.

public ShortBuffer
asShortBuffer()

Overrides java.nio.DirectByteBuffer.asShortBuffer.

Creates a view of this byte buffer as a short buffer.

pack-priv Object
public MappedByteBuffer
compact()

Overrides java.nio.DirectByteBuffer.compact.

Compacts this buffer  (optional operation).

public MappedByteBuffer
duplicate()

Overrides java.nio.DirectByteBuffer.duplicate.

Creates a new byte buffer that shares this buffer's content.

pack-priv AbstractMemorySegmentImpl
heapSegment(Object base, long offset, long length, boolean readOnly, MemorySessionImpl bufferScope)

Overrides java.nio.DirectByteBuffer.heapSegment.

public boolean
isDirect()

Overrides java.nio.DirectByteBuffer.isDirect.

Tells whether or not this byte buffer is direct.

public boolean
isReadOnly()

Overrides java.nio.DirectByteBuffer.isReadOnly.

Tells whether or not this buffer is read-only.

public ByteBuffer
put(byte x)

Overrides java.nio.DirectByteBuffer.put.

Relative put method  (optional operation).

public ByteBuffer
put(int i, byte x)

Overrides java.nio.DirectByteBuffer.put.

Absolute put method  (optional operation).

public ByteBuffer
putChar(char x)

Overrides java.nio.DirectByteBuffer.putChar.

Relative put method for writing a char value  (optional operation).

public ByteBuffer
putChar(int i, char x)

Overrides java.nio.DirectByteBuffer.putChar.

Absolute put method for writing a char value  (optional operation).

public ByteBuffer
putDouble(double x)

Overrides java.nio.DirectByteBuffer.putDouble.

Relative put method for writing a double value  (optional operation).

public ByteBuffer
putDouble(int i, double x)

Overrides java.nio.DirectByteBuffer.putDouble.

Absolute put method for writing a double value  (optional operation).

public ByteBuffer
putFloat(float x)

Overrides java.nio.DirectByteBuffer.putFloat.

Relative put method for writing a float value  (optional operation).

public ByteBuffer
putFloat(int i, float x)

Overrides java.nio.DirectByteBuffer.putFloat.

Absolute put method for writing a float value  (optional operation).

public ByteBuffer
putInt(int x)

Overrides java.nio.DirectByteBuffer.putInt.

Relative put method for writing an int value  (optional operation).

public ByteBuffer
putInt(int i, int x)

Overrides java.nio.DirectByteBuffer.putInt.

Absolute put method for writing an int value  (optional operation).

public ByteBuffer
putLong(long x)

Overrides java.nio.DirectByteBuffer.putLong.

Relative put method for writing a long value  (optional operation).

public ByteBuffer
putLong(int i, long x)

Overrides java.nio.DirectByteBuffer.putLong.

Absolute put method for writing a long value  (optional operation).

public ByteBuffer
putShort(short x)

Overrides java.nio.DirectByteBuffer.putShort.

Relative put method for writing a short value  (optional operation).

public ByteBuffer
putShort(int i, short x)

Overrides java.nio.DirectByteBuffer.putShort.

Absolute put method for writing a short value  (optional operation).

pack-priv int
scaleShifts()

Overrides java.nio.DirectByteBuffer.scaleShifts.

Returns the scale shifts for this Buffer.

public MappedByteBuffer
slice()

Overrides java.nio.DirectByteBuffer.slice.

Creates a new byte buffer whose content is a shared subsequence of this buffer's content.

public MappedByteBuffer
slice(int index, int length)

Overrides java.nio.DirectByteBuffer.slice.

Creates a new byte buffer whose content is a shared subsequence of this buffer's content.

Inherited from java.nio.DirectByteBuffer:
addressattachmentcleanergetgetgetChargetChargetDoublegetDoublegetFloatgetFloatgetIntgetIntgetLonggetLonggetShortgetShort

Constructor Detail

DirectByteBufferRback to summary
pack-priv DirectByteBufferR(int cap)
DirectByteBufferRback to summary
protected DirectByteBufferR(int cap, long addr, FileDescriptor fd, Runnable unmapper, boolean isSync, MemorySegment segment)
DirectByteBufferRback to summary
pack-priv DirectByteBufferR(DirectBuffer db, int mark, int pos, int lim, int cap, int off, FileDescriptor fd, boolean isSync, MemorySegment segment)

Method Detail

asCharBufferback to summary
public CharBuffer asCharBuffer()

Overrides java.nio.DirectByteBuffer.asCharBuffer.

Doc from java.nio.ByteBuffer.asCharBuffer.

Creates a view of this byte buffer as a char buffer.

The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent.

The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided by two, its mark will be undefined, and its byte order will be that of the byte buffer at the moment the view is created. The new buffer will be direct if, and only if, this buffer is direct, and it will be read-only if, and only if, this buffer is read-only.

asDoubleBufferback to summary
public DoubleBuffer asDoubleBuffer()

Overrides java.nio.DirectByteBuffer.asDoubleBuffer.

Doc from java.nio.ByteBuffer.asDoubleBuffer.

Creates a view of this byte buffer as a double buffer.

The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent.

The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided by eight, its mark will be undefined, and its byte order will be that of the byte buffer at the moment the view is created. The new buffer will be direct if, and only if, this buffer is direct, and it will be read-only if, and only if, this buffer is read-only.

asFloatBufferback to summary
public FloatBuffer asFloatBuffer()

Overrides java.nio.DirectByteBuffer.asFloatBuffer.

Doc from java.nio.ByteBuffer.asFloatBuffer.

Creates a view of this byte buffer as a float buffer.

The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent.

The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided by four, its mark will be undefined, and its byte order will be that of the byte buffer at the moment the view is created. The new buffer will be direct if, and only if, this buffer is direct, and it will be read-only if, and only if, this buffer is read-only.

asIntBufferback to summary
public IntBuffer asIntBuffer()

Overrides java.nio.DirectByteBuffer.asIntBuffer.

Doc from java.nio.ByteBuffer.asIntBuffer.

Creates a view of this byte buffer as an int buffer.

The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent.

The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided by four, its mark will be undefined, and its byte order will be that of the byte buffer at the moment the view is created. The new buffer will be direct if, and only if, this buffer is direct, and it will be read-only if, and only if, this buffer is read-only.

asLongBufferback to summary
public LongBuffer asLongBuffer()

Overrides java.nio.DirectByteBuffer.asLongBuffer.

Doc from java.nio.ByteBuffer.asLongBuffer.

Creates a view of this byte buffer as a long buffer.

The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent.

The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided by eight, its mark will be undefined, and its byte order will be that of the byte buffer at the moment the view is created. The new buffer will be direct if, and only if, this buffer is direct, and it will be read-only if, and only if, this buffer is read-only.

asReadOnlyBufferback to summary
public ByteBuffer asReadOnlyBuffer()

Overrides java.nio.DirectByteBuffer.asReadOnlyBuffer.

Doc from java.nio.ByteBuffer.asReadOnlyBuffer.

Creates a new, read-only byte buffer that shares this buffer's content.

The content of the new buffer will be that of this buffer. Changes to this buffer's content will be visible in the new buffer; the new buffer itself, however, will be read-only and will not allow the shared content to be modified. The two buffers' position, limit, and mark values will be independent.

The new buffer's capacity, limit, position, and mark values will be identical to those of this buffer, and its byte order will be BIG_ENDIAN.

If this buffer is itself read-only then this method behaves in exactly the same way as the duplicate method.

asShortBufferback to summary
public ShortBuffer asShortBuffer()

Overrides java.nio.DirectByteBuffer.asShortBuffer.

Doc from java.nio.ByteBuffer.asShortBuffer.

Creates a view of this byte buffer as a short buffer.

The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent.

The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided by two, its mark will be undefined, and its byte order will be that of the byte buffer at the moment the view is created. The new buffer will be direct if, and only if, this buffer is direct, and it will be read-only if, and only if, this buffer is read-only.

baseback to summary
pack-priv Object base()

Overrides java.nio.DirectByteBuffer.base.

Annotations
@Override
compactback to summary
public MappedByteBuffer compact()

Overrides java.nio.DirectByteBuffer.compact.

Doc from java.nio.MappedByteBuffer.compact.

Compacts this buffer  (optional operation).

The bytes between the buffer's current position and its limit, if any, are copied to the beginning of the buffer. That is, the byte at index p = position() is copied to index zero, the byte at index p + 1 is copied to index one, and so forth until the byte at index limit() - 1 is copied to index n = limit() - 1 - p. The buffer's position is then set to n+1 and its limit is set to its capacity. The mark, if defined, is discarded.

The buffer's position is set to the number of bytes copied, rather than to zero, so that an invocation of this method can be followed immediately by an invocation of another relative put method.

Invoke this method after writing data from a buffer in case the write was incomplete. The following loop, for example, copies bytes from one channel to another via the buffer buf:

buf.clear(); // Prepare buffer for use while (in.read(buf) >= 0 || buf.position != 0) { buf.flip(); out.write(buf); buf.compact(); // In case of partial write }
buf.clear();          // Prepare buffer for use
while (in.read(buf) >= 0 || buf.position != 0) {
    buf.flip();
    out.write(buf);
    buf.compact();    // In case of partial write
}
duplicateback to summary
public MappedByteBuffer duplicate()

Overrides java.nio.DirectByteBuffer.duplicate.

Doc from java.nio.MappedByteBuffer.duplicate.

Creates a new byte buffer that shares this buffer's content.

The content of the new buffer will be that of this buffer. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent.

The new buffer's capacity, limit, position, and mark values will be identical to those of this buffer, and its byte order will be BIG_ENDIAN. The new buffer will be direct if, and only if, this buffer is direct, and it will be read-only if, and only if, this buffer is read-only.

heapSegmentback to summary
pack-priv AbstractMemorySegmentImpl heapSegment(Object base, long offset, long length, boolean readOnly, MemorySessionImpl bufferScope)

Overrides java.nio.DirectByteBuffer.heapSegment.

Annotations
@ForceInline
@Override
isDirectback to summary
public boolean isDirect()

Overrides java.nio.DirectByteBuffer.isDirect.

Doc from java.nio.ByteBuffer.isDirect.

Tells whether or not this byte buffer is direct.

isReadOnlyback to summary
public boolean isReadOnly()

Overrides java.nio.DirectByteBuffer.isReadOnly.

Doc from java.nio.Buffer.isReadOnly.

Tells whether or not this buffer is read-only.

putback to summary
public ByteBuffer put(byte x)

Overrides java.nio.DirectByteBuffer.put.

Doc from java.nio.ByteBuffer.put.

Relative put method  (optional operation).

Writes the given byte into this buffer at the current position, and then increments the position.

putback to summary
public ByteBuffer put(int i, byte x)

Overrides java.nio.DirectByteBuffer.put.

Doc from java.nio.ByteBuffer.put.

Absolute put method  (optional operation).

Writes the given byte into this buffer at the given index.

putCharback to summary
public ByteBuffer putChar(char x)

Overrides java.nio.DirectByteBuffer.putChar.

Doc from java.nio.ByteBuffer.putChar.

Relative put method for writing a char value  (optional operation).

Writes two bytes containing the given char value, in the current byte order, into this buffer at the current position, and then increments the position by two.

putCharback to summary
public ByteBuffer putChar(int i, char x)

Overrides java.nio.DirectByteBuffer.putChar.

Doc from java.nio.ByteBuffer.putChar.

Absolute put method for writing a char value  (optional operation).

Writes two bytes containing the given char value, in the current byte order, into this buffer at the given index.

putDoubleback to summary
public ByteBuffer putDouble(double x)

Overrides java.nio.DirectByteBuffer.putDouble.

Doc from java.nio.ByteBuffer.putDouble.

Relative put method for writing a double value  (optional operation).

Writes eight bytes containing the given double value, in the current byte order, into this buffer at the current position, and then increments the position by eight.

putDoubleback to summary
public ByteBuffer putDouble(int i, double x)

Overrides java.nio.DirectByteBuffer.putDouble.

Doc from java.nio.ByteBuffer.putDouble.

Absolute put method for writing a double value  (optional operation).

Writes eight bytes containing the given double value, in the current byte order, into this buffer at the given index.

putFloatback to summary
public ByteBuffer putFloat(float x)

Overrides java.nio.DirectByteBuffer.putFloat.

Doc from java.nio.ByteBuffer.putFloat.

Relative put method for writing a float value  (optional operation).

Writes four bytes containing the given float value, in the current byte order, into this buffer at the current position, and then increments the position by four.

putFloatback to summary
public ByteBuffer putFloat(int i, float x)

Overrides java.nio.DirectByteBuffer.putFloat.

Doc from java.nio.ByteBuffer.putFloat.

Absolute put method for writing a float value  (optional operation).

Writes four bytes containing the given float value, in the current byte order, into this buffer at the given index.

putIntback to summary
public ByteBuffer putInt(int x)

Overrides java.nio.DirectByteBuffer.putInt.

Doc from java.nio.ByteBuffer.putInt.

Relative put method for writing an int value  (optional operation).

Writes four bytes containing the given int value, in the current byte order, into this buffer at the current position, and then increments the position by four.

putIntback to summary
public ByteBuffer putInt(int i, int x)

Overrides java.nio.DirectByteBuffer.putInt.

Doc from java.nio.ByteBuffer.putInt.

Absolute put method for writing an int value  (optional operation).

Writes four bytes containing the given int value, in the current byte order, into this buffer at the given index.

putLongback to summary
public ByteBuffer putLong(long x)

Overrides java.nio.DirectByteBuffer.putLong.

Doc from java.nio.ByteBuffer.putLong.

Relative put method for writing a long value  (optional operation).

Writes eight bytes containing the given long value, in the current byte order, into this buffer at the current position, and then increments the position by eight.

putLongback to summary
public ByteBuffer putLong(int i, long x)

Overrides java.nio.DirectByteBuffer.putLong.

Doc from java.nio.ByteBuffer.putLong.

Absolute put method for writing a long value  (optional operation).

Writes eight bytes containing the given long value, in the current byte order, into this buffer at the given index.

putShortback to summary
public ByteBuffer putShort(short x)

Overrides java.nio.DirectByteBuffer.putShort.

Doc from java.nio.ByteBuffer.putShort.

Relative put method for writing a short value  (optional operation).

Writes two bytes containing the given short value, in the current byte order, into this buffer at the current position, and then increments the position by two.

putShortback to summary
public ByteBuffer putShort(int i, short x)

Overrides java.nio.DirectByteBuffer.putShort.

Doc from java.nio.ByteBuffer.putShort.

Absolute put method for writing a short value  (optional operation).

Writes two bytes containing the given short value, in the current byte order, into this buffer at the given index.

scaleShiftsback to summary
pack-priv int scaleShifts()

Overrides java.nio.DirectByteBuffer.scaleShifts.

Doc from java.nio.Buffer.scaleShifts.

Returns the scale shifts for this Buffer.

The scale shifts are: ByteBuffer: 0 ShortBuffer, CharBuffer: 1 IntBuffer, FloatBuffer: 2 LongBuffer, DoubleBuffer: 3

Annotations
@ForceInline
@Override
sliceback to summary
public MappedByteBuffer slice()

Overrides java.nio.DirectByteBuffer.slice.

Doc from java.nio.MappedByteBuffer.slice.

Creates a new byte buffer whose content is a shared subsequence of this buffer's content.

The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent.

The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer, its mark will be undefined, and its byte order will be BIG_ENDIAN. The new buffer will be direct if, and only if, this buffer is direct, and it will be read-only if, and only if, this buffer is read-only.

Reading bytes into physical memory by invoking load() on the returned buffer, or writing bytes to the storage device by invoking force() on the returned buffer, will only act on the sub-range of this buffer that the returned buffer represents, namely [position(),limit()).

sliceback to summary
public MappedByteBuffer slice(int index, int length)

Overrides java.nio.DirectByteBuffer.slice.

Doc from java.nio.MappedByteBuffer.slice.

Creates a new byte buffer whose content is a shared subsequence of this buffer's content.

The content of the new buffer will start at position index in this buffer, and will contain length elements. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent.

The new buffer's position will be zero, its capacity and its limit will be length, its mark will be undefined, and its byte order will be BIG_ENDIAN. The new buffer will be direct if, and only if, this buffer is direct, and it will be read-only if, and only if, this buffer is read-only.

Reading bytes into physical memory by invoking load() on the returned buffer, or writing bytes to the storage device by invoking force() on the returned buffer, will only act on the sub-range of this buffer that the returned buffer represents, namely [index,index+length), where index and length are assumed to satisfy the preconditions.

Annotations
@Override