1 |
/* ByteBuffer.java -- |
/* ByteBuffer.java -- |
2 |
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. |
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
42 |
* @since 1.4 |
* @since 1.4 |
43 |
*/ |
*/ |
44 |
public abstract class ByteBuffer extends Buffer |
public abstract class ByteBuffer extends Buffer |
45 |
implements Comparable |
implements Comparable<ByteBuffer> |
46 |
{ |
{ |
47 |
ByteOrder endian = ByteOrder.BIG_ENDIAN; |
ByteOrder endian = ByteOrder.BIG_ENDIAN; |
48 |
|
|
290 |
{ |
{ |
291 |
if (obj instanceof ByteBuffer) |
if (obj instanceof ByteBuffer) |
292 |
{ |
{ |
293 |
return compareTo (obj) == 0; |
return compareTo ((ByteBuffer) obj) == 0; |
294 |
} |
} |
295 |
|
|
296 |
return false; |
return false; |
302 |
* @exception ClassCastException If obj is not an object derived from |
* @exception ClassCastException If obj is not an object derived from |
303 |
* <code>ByteBuffer</code>. |
* <code>ByteBuffer</code>. |
304 |
*/ |
*/ |
305 |
public int compareTo (Object obj) |
public int compareTo (ByteBuffer other) |
306 |
{ |
{ |
|
ByteBuffer other = (ByteBuffer) obj; |
|
|
|
|
307 |
int num = Math.min(remaining(), other.remaining()); |
int num = Math.min(remaining(), other.remaining()); |
308 |
int pos_this = position(); |
int pos_this = position(); |
309 |
int pos_other = other.position(); |
int pos_other = other.position(); |