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

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

ShortBufferjava.nio

Java 1.4comparable

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

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

Figure 13-12. java.nio.ShortBuffer

public abstract class

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

allocate (int

capacity ); public static ShortBuffer

wrap (short[ ]

array ); public static ShortBuffer

wrap (short[ ]

array , int

offset , int

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

array ( ); public final int

arrayOffset ( ); public abstract ShortBuffer

asReadOnlyBuffer ( ); public abstract ShortBuffer

compact ( ); public abstract ShortBuffer

duplicate ( ); public abstract short

get ( ); public abstract short

get (int

index ); public ShortBuffer

get (short[ ]

dst ); public ShortBuffer

get (short[ ]

dst , int

offset , int

length ); public final boolean

hasArray ( ); public abstract boolean

isDirect ( ); public abstract ByteOrder

order ( ); public ShortBuffer

put (ShortBuffer

src ); public abstract ShortBuffer

put (short

s ); public final ShortBuffer

put (short[ ]

src ); public abstract ShortBuffer

put (int

index , short

s ); public ShortBuffer

put (short[ ]

src , int

offset , int

length ); public abstract ShortBuffer

slice ( ); // Methods Implementing Comparable

5.0 public int

compareTo (ShortBuffer

that ); // Public Methods Overriding Object public boolean

equals (Object

ob ); public int

hashCode ( ); public String

toString ( ); }

Returned By

ByteBuffer.asShortBuffer( )