41 |
|
|
42 |
public abstract class FloatBuffer extends Buffer implements Comparable |
public abstract class FloatBuffer extends Buffer implements Comparable |
43 |
{ |
{ |
|
private ByteOrder endian = ByteOrder.BIG_ENDIAN; |
|
44 |
protected float [] backing_buffer; |
protected float [] backing_buffer; |
45 |
|
protected int array_offset; |
46 |
|
|
47 |
public static FloatBuffer allocateDirect(int capacity) |
public static FloatBuffer allocateDirect(int capacity) |
48 |
{ |
{ |
49 |
return new FloatBufferImpl (capacity, 0, capacity); |
throw new Error ("direct buffers not implemented"); |
50 |
} |
} |
51 |
|
|
52 |
public static FloatBuffer allocate(int capacity) |
public static FloatBuffer allocate(int capacity) |
77 |
return wrap(array, 0, array.length); |
return wrap(array, 0, array.length); |
78 |
} |
} |
79 |
|
|
80 |
public FloatBuffer get(float[] dst, int offset, int length) |
public FloatBuffer get (float[] 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 FloatBuffer get(float[] dst) |
public FloatBuffer get (float[] dst) |
91 |
{ |
{ |
92 |
return get(dst, 0, dst.length); |
return get(dst, 0, dst.length); |
93 |
} |
} |
94 |
|
|
95 |
public FloatBuffer put(FloatBuffer src) |
public FloatBuffer put (FloatBuffer 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 FloatBuffer put(float[] src, int offset, int length) |
public FloatBuffer put (float[] 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 float[] array() |
public final float[] 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() |
152 |
{ |
{ |
153 |
return compareTo(obj) == 0; |
return compareTo(obj) == 0; |
154 |
} |
} |
155 |
|
|
156 |
return false; |
return false; |
157 |
} |
} |
158 |
|
|
185 |
return 0; |
return 0; |
186 |
} |
} |
187 |
|
|
188 |
public ByteOrder order() |
public abstract ByteOrder order (); |
|
{ |
|
|
return endian; |
|
|
} |
|
|
|
|
|
public final FloatBuffer order(ByteOrder bo) |
|
|
{ |
|
|
endian = bo; |
|
|
return this; |
|
|
} |
|
|
|
|
189 |
public abstract float get(); |
public abstract float get(); |
190 |
public abstract java.nio. FloatBuffer put(float b); |
public abstract java.nio. FloatBuffer put(float b); |
191 |
public abstract float get(int index); |
public abstract float get(int index); |