Package gov.nasa.worldwind.util
Class BufferWrapper.EmptyBufferWrapper
- java.lang.Object
-
- gov.nasa.worldwind.util.BufferWrapper
-
- gov.nasa.worldwind.util.BufferWrapper.EmptyBufferWrapper
-
- Enclosing class:
- BufferWrapper
protected static class BufferWrapper.EmptyBufferWrapper extends BufferWrapper
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class gov.nasa.worldwind.util.BufferWrapper
BufferWrapper.AbstractBufferWrapper<T extends java.nio.Buffer>, BufferWrapper.ByteBufferWrapper, BufferWrapper.DoubleBufferWrapper, BufferWrapper.EmptyBufferWrapper, BufferWrapper.FloatBufferWrapper, BufferWrapper.IntBufferWrapper, BufferWrapper.ShortBufferWrapper
-
-
Field Summary
-
Fields inherited from class gov.nasa.worldwind.util.BufferWrapper
EMPTY_BUFFER_WRAPPER
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
EmptyBufferWrapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BufferWrapper
copyOf(int newSize)
Returns a copy of this buffer with the specified new size.java.nio.Buffer
getBackingBuffer()
Returns the buffer's backing data sture.byte
getByte(int index)
Returns the value at the specified index, cast to a byte.void
getByte(int index, byte[] array, int offset, int length)
Returns the sequence of values starting at the specified index and with the specified length, cast to bytes.double
getDouble(int index)
Returns the value at the specified index, cast to a double.void
getDouble(int index, double[] array, int offset, int length)
Returns the sequence of values starting at the specified index and with the specified length, cast to doubles.float
getFloat(int index)
Returns the value at the specified index, cast to a float.void
getFloat(int index, float[] array, int offset, int length)
Returns the sequence of values starting at the specified index and with the specified length, cast to floats.int
getGLDataType()
Returns the OpenGL data type corresponding to the buffer's underlying data type (e.g.int
getInt(int index)
Returns the value at the specified index, cast to an int.void
getInt(int index, int[] array, int offset, int length)
Returns the sequence of values starting at the specified index and with the specified length, cast to ints.short
getShort(int index)
Returns the value at the specified index, cast to a short.void
getShort(int index, short[] array, int offset, int length)
Returns the sequence of values starting at the specified index and with the specified length, cast to shorts.long
getSizeInBytes()
Returns the size of this buffer, in bytes.BufferWrapper
getSubBuffer(int index, int length)
Returns a new BufferWrapper which is a subsequence of this buffer.int
length()
Returns the length of the buffer, in units of the underlying data type (e.g.void
putByte(int index, byte value)
Sets the value at the specified index as a byte.void
putByte(int index, byte[] array, int offset, int length)
Sets the sequence of values starting at the specified index and with the specified length, as bytes.void
putDouble(int index, double value)
Sets the value at the specified index as a double.void
putDouble(int index, double[] array, int offset, int length)
Sets the sequence of values starting at the specified index and with the specified length, as doubles.void
putFloat(int index, float value)
Sets the value at the specified index as a float.void
putFloat(int index, float[] array, int offset, int length)
Sets the sequence of values starting at the specified index and with the specified length, as floats.void
putInt(int index, int value)
Sets the value at the specified index as an int.void
putInt(int index, int[] array, int offset, int length)
Sets the sequence of values starting at the specified index and with the specified length, as ints.void
putShort(int index, short value)
Sets the value at the specified index as a short.void
putShort(int index, short[] array, int offset, int length)
Sets the sequence of values starting at the specified index and with the specified length, as ints.void
putSubBuffer(int index, BufferWrapper buffer)
Sets a subsequence of this buffer with the contents of the specified buffer.void
putSubBuffer(int index, BufferWrapper buffer, int offset, int length)
Sets a subsequence of this buffer with the contents of the specified buffer.-
Methods inherited from class gov.nasa.worldwind.util.BufferWrapper
emptyBufferWrapper, wrap, wrap, wrap
-
-
-
-
Method Detail
-
length
public int length()
Description copied from class:BufferWrapper
Returns the length of the buffer, in units of the underlying data type (e.g. bytes, shorts, ints, floats, doubles).- Specified by:
length
in classBufferWrapper
- Returns:
- the buffer's length.
-
getGLDataType
public int getGLDataType()
Description copied from class:BufferWrapper
Returns the OpenGL data type corresponding to the buffer's underlying data type (e.g. GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT, GL_DOUBLE).- Specified by:
getGLDataType
in classBufferWrapper
- Returns:
- the buffer's OpenGL data type.
-
getSizeInBytes
public long getSizeInBytes()
Description copied from class:BufferWrapper
Returns the size of this buffer, in bytes.- Specified by:
getSizeInBytes
in classBufferWrapper
- Returns:
- the buffer's size in bytes.
-
getByte
public byte getByte(int index)
Description copied from class:BufferWrapper
Returns the value at the specified index, cast to a byte.- Specified by:
getByte
in classBufferWrapper
- Parameters:
index
- the index of the value to be returned.- Returns:
- the byte at the specified index.
-
putByte
public void putByte(int index, byte value)
Description copied from class:BufferWrapper
Sets the value at the specified index as a byte. The byte is cast to the underlying data type.- Specified by:
putByte
in classBufferWrapper
- Parameters:
index
- the index of the value to be returned.value
- the byte value to be set.
-
getShort
public short getShort(int index)
Description copied from class:BufferWrapper
Returns the value at the specified index, cast to a short.- Specified by:
getShort
in classBufferWrapper
- Parameters:
index
- the index of the value to be returned.- Returns:
- the short at the specified index.
-
putShort
public void putShort(int index, short value)
Description copied from class:BufferWrapper
Sets the value at the specified index as a short. The short is cast to the underlying data type.- Specified by:
putShort
in classBufferWrapper
- Parameters:
index
- the index of the value to be returned.value
- the short value to be set.
-
getInt
public int getInt(int index)
Description copied from class:BufferWrapper
Returns the value at the specified index, cast to an int.- Specified by:
getInt
in classBufferWrapper
- Parameters:
index
- the index of the value to be returned.- Returns:
- the int at the specified index.
-
putInt
public void putInt(int index, int value)
Description copied from class:BufferWrapper
Sets the value at the specified index as an int. The int is cast to the underlying data type.- Specified by:
putInt
in classBufferWrapper
- Parameters:
index
- the index of the value to be returned.value
- the int value to be set.
-
getFloat
public float getFloat(int index)
Description copied from class:BufferWrapper
Returns the value at the specified index, cast to a float.- Specified by:
getFloat
in classBufferWrapper
- Parameters:
index
- the index of the value to be returned.- Returns:
- the float at the specified index.
-
putFloat
public void putFloat(int index, float value)
Description copied from class:BufferWrapper
Sets the value at the specified index as a float. The float is cast to the underlying data type.- Specified by:
putFloat
in classBufferWrapper
- Parameters:
index
- the index of the value to be returned.value
- the float value to be set.
-
getDouble
public double getDouble(int index)
Description copied from class:BufferWrapper
Returns the value at the specified index, cast to a double.- Specified by:
getDouble
in classBufferWrapper
- Parameters:
index
- the index of the value to be returned.- Returns:
- the double at the specified index.
-
putDouble
public void putDouble(int index, double value)
Description copied from class:BufferWrapper
Sets the value at the specified index as a double. The double is cast to the underlying data type.- Specified by:
putDouble
in classBufferWrapper
- Parameters:
index
- the index of the value to be returned.value
- the double value to be set.
-
getByte
public void getByte(int index, byte[] array, int offset, int length)
Description copied from class:BufferWrapper
Returns the sequence of values starting at the specified index and with the specified length, cast to bytes.- Specified by:
getByte
in classBufferWrapper
- Parameters:
index
- the buffer starting index.array
- the array.offset
- the array starting index.length
- the number of values to get.
-
putByte
public void putByte(int index, byte[] array, int offset, int length)
Description copied from class:BufferWrapper
Sets the sequence of values starting at the specified index and with the specified length, as bytes. The bytes are cast to the underlying data type.- Specified by:
putByte
in classBufferWrapper
- Parameters:
index
- the buffer starting index.array
- the array.offset
- the array starting index.length
- the number of values to put.
-
getShort
public void getShort(int index, short[] array, int offset, int length)
Description copied from class:BufferWrapper
Returns the sequence of values starting at the specified index and with the specified length, cast to shorts.- Specified by:
getShort
in classBufferWrapper
- Parameters:
index
- the buffer starting index.array
- the array.offset
- the array starting index.length
- the number of values to get.
-
putShort
public void putShort(int index, short[] array, int offset, int length)
Description copied from class:BufferWrapper
Sets the sequence of values starting at the specified index and with the specified length, as ints. The ints are cast to the underlying data type.- Specified by:
putShort
in classBufferWrapper
- Parameters:
index
- the buffer starting index.array
- the array.offset
- the array starting index.length
- the number of values to put.
-
getInt
public void getInt(int index, int[] array, int offset, int length)
Description copied from class:BufferWrapper
Returns the sequence of values starting at the specified index and with the specified length, cast to ints.- Specified by:
getInt
in classBufferWrapper
- Parameters:
index
- the buffer starting index.array
- the array.offset
- the array starting index.length
- the number of values to get.
-
putInt
public void putInt(int index, int[] array, int offset, int length)
Description copied from class:BufferWrapper
Sets the sequence of values starting at the specified index and with the specified length, as ints. The ints are cast to the underlying data type.- Specified by:
putInt
in classBufferWrapper
- Parameters:
index
- the buffer starting index.array
- the array.offset
- the array starting index.length
- the number of values to put.
-
getFloat
public void getFloat(int index, float[] array, int offset, int length)
Description copied from class:BufferWrapper
Returns the sequence of values starting at the specified index and with the specified length, cast to floats.- Specified by:
getFloat
in classBufferWrapper
- Parameters:
index
- the buffer starting index.array
- the array.offset
- the array starting index.length
- the number of values to get.
-
putFloat
public void putFloat(int index, float[] array, int offset, int length)
Description copied from class:BufferWrapper
Sets the sequence of values starting at the specified index and with the specified length, as floats. The floats are cast to the underlying data type.- Specified by:
putFloat
in classBufferWrapper
- Parameters:
index
- the buffer starting index.array
- the array.offset
- the array starting index.length
- the number of values to put.
-
getDouble
public void getDouble(int index, double[] array, int offset, int length)
Description copied from class:BufferWrapper
Returns the sequence of values starting at the specified index and with the specified length, cast to doubles.- Specified by:
getDouble
in classBufferWrapper
- Parameters:
index
- the buffer starting index.array
- the array.offset
- the array starting index.length
- the number of values to get.
-
putDouble
public void putDouble(int index, double[] array, int offset, int length)
Description copied from class:BufferWrapper
Sets the sequence of values starting at the specified index and with the specified length, as doubles. The doubles are cast to the underlying data type.- Specified by:
putDouble
in classBufferWrapper
- Parameters:
index
- the buffer starting index.array
- the array.offset
- the array starting index.length
- the number of values to put.
-
getSubBuffer
public BufferWrapper getSubBuffer(int index, int length)
Description copied from class:BufferWrapper
Returns a new BufferWrapper which is a subsequence of this buffer. The new buffer starts with the value at the specified index, and has the specified length. The two buffers share the same backing store, so changes to this buffer are reflected in the new buffer, and vice versa.- Specified by:
getSubBuffer
in classBufferWrapper
- Parameters:
index
- the new buffer's starting index.length
- the new buffer's length.- Returns:
- a subsequence of this buffer.
-
putSubBuffer
public void putSubBuffer(int index, BufferWrapper buffer)
Description copied from class:BufferWrapper
Sets a subsequence of this buffer with the contents of the specified buffer. The subsequence to set starts with the value at the specified index, and has length equal to the specified buffer's length.- Specified by:
putSubBuffer
in classBufferWrapper
- Parameters:
index
- the starting index to set.buffer
- the buffer.
-
putSubBuffer
public void putSubBuffer(int index, BufferWrapper buffer, int offset, int length)
Description copied from class:BufferWrapper
Sets a subsequence of this buffer with the contents of the specified buffer. The subsequence to set starts with the value at the specified index, and has length equal to the specified length.- Specified by:
putSubBuffer
in classBufferWrapper
- Parameters:
index
- the starting index to set.buffer
- the buffer.offset
- the starting index to get from the buffer.length
- the number of values to get from the buffer.
-
copyOf
public BufferWrapper copyOf(int newSize)
Description copied from class:BufferWrapper
Returns a copy of this buffer with the specified new size. The new size must be greater than or equal to this buffer's size. If the new size is greater than this buffer's size, this returns a new buffer which is partially filled with the contents of this buffer. The returned buffer has the same backing buffer type, but its contents are independent from this VecBuffer.- Specified by:
copyOf
in classBufferWrapper
- Parameters:
newSize
- the new buffer's size.- Returns:
- the new buffer, with the specified size.
-
getBackingBuffer
public java.nio.Buffer getBackingBuffer()
Description copied from class:BufferWrapper
Returns the buffer's backing data sture. For the standard BufferWrapper types (ByteBufferWrapper, ShortBufferWrapper, IntBufferWrapper, FloatBufferWrapper, and DoubleBufferWrapper), this returns the backingBuffer
.- Specified by:
getBackingBuffer
in classBufferWrapper
- Returns:
- the backing data store.
-
-