41 |
|
|
42 |
public abstract class ShortBuffer extends Buffer implements Comparable |
public abstract class ShortBuffer extends Buffer implements Comparable |
43 |
{ |
{ |
|
private ByteOrder endian = ByteOrder.BIG_ENDIAN; |
|
44 |
protected short [] backing_buffer; |
protected short [] backing_buffer; |
45 |
|
protected int array_offset; |
46 |
|
|
47 |
public static ShortBuffer allocateDirect(int capacity) |
public static ShortBuffer allocateDirect(int capacity) |
48 |
{ |
{ |
49 |
return new ShortBufferImpl(capacity, 0, capacity); |
throw new Error ("direct buffers not implemented"); |
50 |
} |
} |
51 |
|
|
52 |
public static ShortBuffer allocate(int capacity) |
public static ShortBuffer allocate(int capacity) |
77 |
return wrap(array, 0, array.length); |
return wrap(array, 0, array.length); |
78 |
} |
} |
79 |
|
|
80 |
public ShortBuffer get(short[] dst, int offset, int length) |
public ShortBuffer get (short[] dst, int offset, int length) |
81 |
{ |
{ |
82 |
for (int i = offset; i < offset + length; i++) |
for (int i = offset; i < offset + length; i++) |
83 |
{ |
{ |
87 |
return this; |
return this; |
88 |
} |
} |
89 |
|
|
90 |
public ShortBuffer get(short[] dst) |
public ShortBuffer get (short[] dst) |
91 |
{ |
{ |
92 |
return get(dst, 0, dst.length); |
return get(dst, 0, dst.length); |
93 |
} |
} |
94 |
|
|
95 |
public ShortBuffer put(ShortBuffer src) |
public ShortBuffer put (ShortBuffer src) |
96 |
{ |
{ |
97 |
while (src.hasRemaining()) |
while (src.hasRemaining()) |
98 |
put(src.get()); |
put(src.get()); |
100 |
return this; |
return this; |
101 |
} |
} |
102 |
|
|
103 |
public ShortBuffer put(short[] src, int offset, int length) |
public ShortBuffer put (short[] src, int offset, int length) |
104 |
{ |
{ |
105 |
for (int i = offset; i < offset + length; i++) |
for (int i = offset; i < offset + length; i++) |
106 |
put(src[i]); |
put(src[i]); |
115 |
|
|
116 |
public final boolean hasArray() |
public final boolean hasArray() |
117 |
{ |
{ |
118 |
return (backing_buffer != null); |
return (backing_buffer != null |
119 |
|
&& !isReadOnly ()); |
120 |
} |
} |
121 |
|
|
122 |
public final short[] array() |
public final short[] array() |
123 |
{ |
{ |
124 |
|
if (backing_buffer == null) |
125 |
|
throw new UnsupportedOperationException (); |
126 |
|
|
127 |
|
if (isReadOnly ()) |
128 |
|
throw new ReadOnlyBufferException (); |
129 |
|
|
130 |
return backing_buffer; |
return backing_buffer; |
131 |
} |
} |
132 |
|
|
133 |
public final int arrayOffset() |
public final int arrayOffset() |
134 |
{ |
{ |
135 |
return 0; |
if (backing_buffer == null) |
136 |
|
throw new UnsupportedOperationException (); |
137 |
|
|
138 |
|
if (isReadOnly ()) |
139 |
|
throw new ReadOnlyBufferException (); |
140 |
|
|
141 |
|
return array_offset; |
142 |
} |
} |
143 |
|
|
144 |
public int hashCode() |
public int hashCode() |
186 |
return 0; |
return 0; |
187 |
} |
} |
188 |
|
|
189 |
public ByteOrder order() |
public abstract ByteOrder order (); |
|
{ |
|
|
return endian; |
|
|
} |
|
|
|
|
|
public final ShortBuffer order(ByteOrder bo) |
|
|
{ |
|
|
endian = bo; |
|
|
return this; |
|
|
} |
|
|
|
|
190 |
public abstract short get(); |
public abstract short get(); |
191 |
public abstract java.nio. ShortBuffer put(short b); |
public abstract java.nio. ShortBuffer put(short b); |
192 |
public abstract short get(int index); |
public abstract short get(int index); |