181 |
|
|
182 |
final public char getChar () |
final public char getChar () |
183 |
{ |
{ |
184 |
// FIXME: this handles big endian only |
// FIXME: this handles little endian only |
185 |
return (char) (((get () & 0xff) << 8) + (get () & 0xff)); |
return (char) (((get () & 0xff) << 8) |
186 |
|
+ (get () & 0xff)); |
187 |
} |
} |
188 |
|
|
189 |
final public ByteBuffer putChar (char value) |
final public ByteBuffer putChar (char value) |
190 |
{ |
{ |
191 |
// FIXME: this handles big endian only |
// FIXME: this handles little endian only |
192 |
put ((byte) ((((int) value) & 0xff00) >> 8)); |
put ((byte) ((((int) value) & 0xff00) >> 8)); |
193 |
put ((byte) (((int) value) & 0x00ff)); |
put ((byte) (((int) value) & 0x00ff)); |
194 |
return this; |
return this; |
196 |
|
|
197 |
final public char getChar (int index) |
final public char getChar (int index) |
198 |
{ |
{ |
199 |
// FIXME: this handles big endian only |
// FIXME: this handles little endian only |
200 |
return (char) (((get (index) & 0xff) << 8) + (get (index + 1) & 0xff)); |
return (char) (((get (index) & 0xff) << 8) |
201 |
|
+ (get (index + 1) & 0xff)); |
202 |
} |
} |
203 |
|
|
204 |
final public ByteBuffer putChar (int index, char value) |
final public ByteBuffer putChar (int index, char value) |
205 |
{ |
{ |
206 |
// FIXME: this handles big endian only |
// FIXME: this handles little endian only |
207 |
put (index, (byte) ((((int) value) & 0xff00) >> 8)); |
put (index, (byte) ((((int) value) & 0xff00) >> 8)); |
208 |
put (index + 1, (byte) (((int) value) & 0x00ff)); |
put (index + 1, (byte) (((int) value) & 0x00ff)); |
209 |
return this; |
return this; |
211 |
|
|
212 |
final public short getShort () |
final public short getShort () |
213 |
{ |
{ |
214 |
// FIXME: this handles big endian only |
// FIXME: this handles little endian only |
215 |
return (short) (((get () & 0xff) << 8) + (get () & 0xff)); |
return (short) (((get () & 0xff) << 8) |
216 |
|
+ (get () & 0xff)); |
217 |
} |
} |
218 |
|
|
219 |
final public ByteBuffer putShort (short value) |
final public ByteBuffer putShort (short value) |
220 |
{ |
{ |
221 |
// FIXME: this handles big endian only |
// FIXME: this handles little endian only |
222 |
put ((byte) ((((int) value) & 0xff00) >> 8)); |
put ((byte) ((((int) value) & 0xff00) >> 8)); |
223 |
put ((byte) (((int) value) & 0x00ff)); |
put ((byte) (((int) value) & 0x00ff)); |
224 |
return this; |
return this; |
226 |
|
|
227 |
final public short getShort (int index) |
final public short getShort (int index) |
228 |
{ |
{ |
229 |
// FIXME: this handles big endian only |
// FIXME: this handles little endian only |
230 |
return (short) (((get (index) & 0xff) << 8) + (get (index + 1) & 0xff)); |
return (short) (((get (index) & 0xff) << 8) |
231 |
|
+ (get (index + 1) & 0xff)); |
232 |
} |
} |
233 |
|
|
234 |
final public ByteBuffer putShort (int index, short value) |
final public ByteBuffer putShort (int index, short value) |
235 |
{ |
{ |
236 |
// FIXME: this handles big endian only |
// FIXME: this handles little endian only |
237 |
put (index, (byte) ((((int) value) & 0xff00) >> 8)); |
put (index, (byte) ((((int) value) & 0xff00) >> 8)); |
238 |
put (index + 1, (byte) (((int) value) & 0x00ff)); |
put (index + 1, (byte) (((int) value) & 0x00ff)); |
239 |
return this; |
return this; |
241 |
|
|
242 |
final public int getInt () |
final public int getInt () |
243 |
{ |
{ |
244 |
// FIXME: this handles big endian only |
// FIXME: this handles little endian only |
245 |
return (int) (((get () & 0xff) << 24) |
return (int) (((get () & 0xff) << 24) |
246 |
+ (get () & 0xff) << 16 |
+ ((get () & 0xff) << 16) |
247 |
+ (get () & 0xff) << 8 |
+ ((get () & 0xff) << 8) |
248 |
+ (get () & 0xff)); |
+ (get () & 0xff)); |
249 |
} |
} |
250 |
|
|
251 |
final public ByteBuffer putInt (int value) |
final public ByteBuffer putInt (int value) |
252 |
{ |
{ |
253 |
// FIXME: this handles big endian only |
// FIXME: this handles little endian only |
254 |
put ((byte) ((((int) value) & 0xff000000) >> 24)); |
put ((byte) ((((int) value) & 0xff000000) >> 24)); |
255 |
put ((byte) ((((int) value) & 0x00ff0000) >> 16)); |
put ((byte) ((((int) value) & 0x00ff0000) >> 16)); |
256 |
put ((byte) ((((int) value) & 0x0000ff00) >> 8)); |
put ((byte) ((((int) value) & 0x0000ff00) >> 8)); |
260 |
|
|
261 |
final public int getInt (int index) |
final public int getInt (int index) |
262 |
{ |
{ |
263 |
// FIXME: this handles big endian only |
// FIXME: this handles little endian only |
264 |
return (int) (((get (index) & 0xff) << 24) |
return (int) (((get (index) & 0xff) << 24) |
265 |
+ (get (index + 1) & 0xff) << 16 |
+ ((get (index + 1) & 0xff) << 16) |
266 |
+ (get (index + 2) & 0xff) << 8 |
+ ((get (index + 2) & 0xff) << 8) |
267 |
+ (get (index + 3) & 0xff)); |
+ (get (index + 3) & 0xff)); |
268 |
} |
} |
269 |
|
|
270 |
final public ByteBuffer putInt (int index, int value) |
final public ByteBuffer putInt (int index, int value) |
271 |
{ |
{ |
272 |
// FIXME: this handles big endian only |
// FIXME: this handles little endian only |
273 |
put (index, (byte) ((((int) value) & 0xff000000) >> 24)); |
put (index, (byte) ((((int) value) & 0xff000000) >> 24)); |
274 |
put (index + 1, (byte) ((((int) value) & 0x00ff0000) >> 16)); |
put (index + 1, (byte) ((((int) value) & 0x00ff0000) >> 16)); |
275 |
put (index + 2, (byte) ((((int) value) & 0x0000ff00) >> 8)); |
put (index + 2, (byte) ((((int) value) & 0x0000ff00) >> 8)); |
279 |
|
|
280 |
final public long getLong () |
final public long getLong () |
281 |
{ |
{ |
282 |
// FIXME: this handles big endian only |
// FIXME: this handles little endian only |
283 |
return (long) (((get () & 0xff) << 56) |
return (long) (((get () & 0xff) << 56) |
284 |
+ (get () & 0xff) << 48 |
+ ((get () & 0xff) << 48) |
285 |
+ (get () & 0xff) << 40 |
+ ((get () & 0xff) << 40) |
286 |
+ (get () & 0xff) << 32 |
+ ((get () & 0xff) << 32) |
287 |
+ (get () & 0xff) << 24 |
+ ((get () & 0xff) << 24) |
288 |
+ (get () & 0xff) << 16 |
+ ((get () & 0xff) << 16) |
289 |
+ (get () & 0xff) << 8 |
+ ((get () & 0xff) << 8) |
290 |
+ (get () & 0xff)); |
+ (get () & 0xff)); |
291 |
} |
} |
292 |
|
|
293 |
final public ByteBuffer putLong (long value) |
final public ByteBuffer putLong (long value) |
294 |
{ |
{ |
295 |
// FIXME: this handles big endian only |
return ByteBufferHelper.putLong (this, value); |
|
put ((byte) ((value & 0xff00000000000000L) >> 56)); |
|
|
put ((byte) ((value & 0x00ff000000000000L) >> 48)); |
|
|
put ((byte) ((value & 0x0000ff0000000000L) >> 40)); |
|
|
put ((byte) ((value & 0x000000ff00000000L) >> 32)); |
|
|
put ((byte) ((value & 0x00000000ff000000L) >> 24)); |
|
|
put ((byte) ((value & 0x0000000000ff0000L) >> 16)); |
|
|
put ((byte) ((value & 0x000000000000ff00L) >> 8)); |
|
|
put ((byte) (value & 0x00000000000000ffL)); |
|
|
return this; |
|
296 |
} |
} |
297 |
|
|
298 |
final public long getLong (int index) |
final public long getLong (int index) |
299 |
{ |
{ |
300 |
// FIXME: this handles big endian only |
return ByteBufferHelper.getLong (this, index); |
|
return (long) (((get (index) & 0xff) << 56) |
|
|
+ (get (index + 1) & 0xff) << 48 |
|
|
+ (get (index + 2) & 0xff) << 40 |
|
|
+ (get (index + 3) & 0xff) << 32 |
|
|
+ (get (index + 4) & 0xff) << 24 |
|
|
+ (get (index + 5) & 0xff) << 16 |
|
|
+ (get (index + 6) & 0xff) << 8 |
|
|
+ (get (index + 7) & 0xff)); |
|
301 |
} |
} |
302 |
|
|
303 |
final public ByteBuffer putLong (int index, long value) |
final public ByteBuffer putLong (int index, long value) |
304 |
{ |
{ |
305 |
// FIXME: this handles big endian only |
return ByteBufferHelper.putLong (this, index, value); |
|
put (index, (byte) ((value & 0xff00000000000000L) >> 56)); |
|
|
put (index + 1, (byte) ((value & 0x00ff000000000000L) >> 48)); |
|
|
put (index + 2, (byte) ((value & 0x0000ff0000000000L) >> 40)); |
|
|
put (index + 3, (byte) ((value & 0x000000ff00000000L) >> 32)); |
|
|
put (index + 4, (byte) ((value & 0x00000000ff000000L) >> 24)); |
|
|
put (index + 5, (byte) ((value & 0x0000000000ff0000L) >> 16)); |
|
|
put (index + 6, (byte) ((value & 0x000000000000ff00L) >> 8)); |
|
|
put (index + 7, (byte) (value & 0x00000000000000ffL)); |
|
|
return this; |
|
306 |
} |
} |
307 |
|
|
308 |
final public float getFloat () |
final public float getFloat () |
309 |
{ |
{ |
310 |
// FIXME: this handles big endian only |
return ByteBufferHelper.getFloat (this); |
|
return (float) (((get () & 0xff) << 24) |
|
|
+ (get () & 0xff) << 16 |
|
|
+ (get () & 0xff) << 8 |
|
|
+ (get () & 0xff)); |
|
311 |
} |
} |
312 |
|
|
313 |
final public ByteBuffer putFloat (float value) |
final public ByteBuffer putFloat (float value) |
314 |
{ |
{ |
315 |
// FIXME: this handles big endian only |
return ByteBufferHelper.putFloat (this, value); |
|
put ((byte) ((((int) value) & 0xff000000) >> 24)); |
|
|
put ((byte) ((((int) value) & 0x00ff0000) >> 16)); |
|
|
put ((byte) ((((int) value) & 0x0000ff00) >> 8)); |
|
|
put ((byte) (((int) value) & 0x000000ff)); |
|
|
return this; |
|
316 |
} |
} |
317 |
|
|
318 |
final public float getFloat (int index) |
public final float getFloat (int index) |
319 |
{ |
{ |
320 |
// FIXME: this handles big endian only |
return ByteBufferHelper.getFloat (this, index); |
|
return (float) (((get (index) & 0xff) << 24) |
|
|
+ (get (index + 1) & 0xff) << 16 |
|
|
+ (get (index + 2) & 0xff) << 8 |
|
|
+ (get (index + 3) & 0xff)); |
|
321 |
} |
} |
322 |
|
|
323 |
final public ByteBuffer putFloat (int index, float value) |
final public ByteBuffer putFloat (int index, float value) |
324 |
{ |
{ |
325 |
// FIXME: this handles big endian only |
return ByteBufferHelper.putFloat (this, index, value); |
|
put (index, (byte) ((((int) value) & 0xff000000) >> 24)); |
|
|
put (index + 1, (byte) ((((int) value) & 0x00ff0000) >> 16)); |
|
|
put (index + 2, (byte) ((((int) value) & 0x0000ff00) >> 8)); |
|
|
put (index + 3, (byte) (((int) value) & 0x000000ff)); |
|
|
return this; |
|
326 |
} |
} |
327 |
|
|
328 |
final public double getDouble () |
final public double getDouble () |
329 |
{ |
{ |
330 |
// FIXME: this handles big endian only |
return ByteBufferHelper.getDouble (this); |
|
return (double) (((get () & 0xff) << 56) |
|
|
+ (get () & 0xff) << 48 |
|
|
+ (get () & 0xff) << 40 |
|
|
+ (get () & 0xff) << 32 |
|
|
+ (get () & 0xff) << 24 |
|
|
+ (get () & 0xff) << 16 |
|
|
+ (get () & 0xff) << 8 |
|
|
+ (get () & 0xff)); |
|
331 |
} |
} |
332 |
|
|
333 |
final public ByteBuffer putDouble (double value) |
final public ByteBuffer putDouble (double value) |
334 |
{ |
{ |
335 |
// FIXME: this handles big endian only |
return ByteBufferHelper.putDouble (this, value); |
|
put ((byte) ((((long) value) & 0xff00000000000000L) >> 56)); |
|
|
put ((byte) ((((long) value) & 0x00ff000000000000L) >> 48)); |
|
|
put ((byte) ((((long) value) & 0x0000ff0000000000L) >> 40)); |
|
|
put ((byte) ((((long) value) & 0x000000ff00000000L) >> 32)); |
|
|
put ((byte) ((((long) value) & 0x00000000ff000000L) >> 24)); |
|
|
put ((byte) ((((long) value) & 0x0000000000ff0000L) >> 16)); |
|
|
put ((byte) ((((long) value) & 0x000000000000ff00L) >> 8)); |
|
|
put ((byte) (((long) value) & 0x00000000000000ffL)); |
|
|
return this; |
|
336 |
} |
} |
337 |
|
|
338 |
final public double getDouble (int index) |
final public double getDouble (int index) |
339 |
{ |
{ |
340 |
// FIXME: this handles big endian only |
return ByteBufferHelper.getDouble (this, index); |
|
return (double) (((get (index) & 0xff) << 56) |
|
|
+ (get (index + 1) & 0xff) << 48 |
|
|
+ (get (index + 2) & 0xff) << 40 |
|
|
+ (get (index + 3) & 0xff) << 32 |
|
|
+ (get (index + 4) & 0xff) << 24 |
|
|
+ (get (index + 5) & 0xff) << 16 |
|
|
+ (get (index + 6) & 0xff) << 8 |
|
|
+ (get (index + 7) & 0xff)); |
|
341 |
} |
} |
342 |
|
|
343 |
final public ByteBuffer putDouble (int index, double value) |
final public ByteBuffer putDouble (int index, double value) |
344 |
{ |
{ |
345 |
// FIXME: this handles big endian only |
return ByteBufferHelper.putDouble (this, index, value); |
|
put (index, (byte) ((((long) value) & 0xff00000000000000L) >> 56)); |
|
|
put (index + 1, (byte) ((((long) value) & 0x00ff000000000000L) >> 48)); |
|
|
put (index + 2, (byte) ((((long) value) & 0x0000ff0000000000L) >> 40)); |
|
|
put (index + 3, (byte) ((((long) value) & 0x000000ff00000000L) >> 32)); |
|
|
put (index + 4, (byte) ((((long) value) & 0x00000000ff000000L) >> 24)); |
|
|
put (index + 5, (byte) ((((long) value) & 0x0000000000ff0000L) >> 16)); |
|
|
put (index + 6, (byte) ((((long) value) & 0x000000000000ff00L) >> 8)); |
|
|
put (index + 7, (byte) (((long) value) & 0x00000000000000ffL)); |
|
|
return this; |
|
346 |
} |
} |
347 |
} |
} |