Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 416
نمايش فراداده

IntBufferjava.nio

Java 1.4comparable

IntBuffer holds a sequence of int 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 int and int[ ] argument and return values instead of byte and byte[ ] values. See ByteBuffer for details.

IntBuffer 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" IntBuffer by calling the asIntBuffer( ) method of an underlying ByteBuffer.

Figure 13-7. java.nio.IntBuffer

public abstract class

IntBuffer extends Buffer implements Comparable<IntBuffer> { // No Constructor // Public Class Methods public static IntBuffer

allocate (int

capacity ); public static IntBuffer

wrap (int[ ]

array ); public static IntBuffer

wrap (int[ ]

array , int

offset , int

length ); // Public Instance Methods public final int[ ]

array ( ); public final int

arrayOffset ( ); public abstract IntBuffer

asReadOnlyBuffer ( ); public abstract IntBuffer

compact ( ); public abstract IntBuffer

duplicate ( ); public abstract int

get ( ); public abstract int

get (int

index ); public IntBuffer

get (int[ ]

dst ); public IntBuffer

get (int[ ]

dst , int

offset , int

length ); public final boolean

hasArray ( ); public abstract boolean

isDirect ( ); public abstract ByteOrder

order ( ); public IntBuffer

put (IntBuffer

src ); public abstract IntBuffer

put (int

i ); public final IntBuffer

put (int[ ]

src ); public abstract IntBuffer

put (int

index , int

i ); public IntBuffer

put (int[ ]

src , int

offset , int

length ); public abstract IntBuffer

slice ( ); // Methods Implementing Comparable

5.0 public int

compareTo (IntBuffer

that ); // Public Methods Overriding Object public boolean

equals (Object

ob ); public int

hashCode ( ); public String

toString ( ); }

Returned By

ByteBuffer.asIntBuffer( )