Name

ShortBuffer

Synopsis

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.

java.nio.ShortBuffer

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  ...

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.