Team LiB
Previous Section Next Section

FloatBufferjava.nio

Java 1.4comparable

FloatBuffer holds a sequence of float values for use in an I/O operation. Most of the methods of this class are directly analogous to methods defined by ByteBuffer except that they use float and float[ ] argument and return values instead of byte and byte[ ] values. See ByteBuffer for details.

FloatBuffer is abstract and has no constructor. Create one by calling the static allocate( ) or wrap( ) methods, which are also analogs of ByteBuffer methods. Or, create a "view" FloatBuffer by calling the asFloatBuffer( ) method of an underlying ByteBuffer.

Figure 13-6. java.nio.FloatBuffer


public abstract class FloatBuffer extends Buffer 
implements Comparable<FloatBuffer> {
// No Constructor
// Public Class Methods
     public static FloatBuffer allocate(int capacity);  
     public static FloatBuffer wrap(float[ ] array);  
     public static FloatBuffer wrap(float[ ] array, int offset, int length);  
// Public Instance Methods
     public final float[ ] array( );  
     public final int arrayOffset( );  
     public abstract FloatBuffer asReadOnlyBuffer( );  
     public abstract FloatBuffer compact( );  
     public abstract FloatBuffer duplicate( );  
     public abstract float get( );  
     public abstract float get(int index);  
     public FloatBuffer get(float[ ] dst);  
     public FloatBuffer get(float[ ] dst, int offset, int length);  
     public final boolean hasArray( );  
     public abstract boolean isDirect( );  
     public abstract ByteOrder order( );  
     public FloatBuffer put(FloatBuffer src);  
     public abstract FloatBuffer put(float f);  
     public final FloatBuffer put(float[ ] src);  
     public abstract FloatBuffer put(int index, float f);  
     public FloatBuffer put(float[ ] src, int offset, int length);  
     public abstract FloatBuffer slice( );  
// Methods Implementing Comparable
5.0  public int compareTo(FloatBuffer that);  
// Public Methods Overriding Object
     public boolean equals(Object ob);  
     public int hashCode( );  
     public String toString( );  
}

Returned By

ByteBuffer.asFloatBuffer( )

    Team LiB
    Previous Section Next Section