52 |
} |
} |
53 |
} |
} |
54 |
|
|
55 |
/** Used by MappedByteBufferImpl to prevent premature GC. */ |
/** Used by MappedByteBufferImpl and when slicing to prevent premature GC. */ |
56 |
protected Object owner; |
protected Object owner; |
57 |
|
|
58 |
RawData address; |
RawData address; |
73 |
this.owner = owner; |
this.owner = owner; |
74 |
} |
} |
75 |
|
|
76 |
|
/** |
77 |
|
* Allocates a new direct byte buffer. |
78 |
|
*/ |
79 |
|
public static ByteBuffer allocate(int capacity) |
80 |
|
{ |
81 |
|
return new DirectByteBufferImpl(allocateImpl(capacity), capacity); |
82 |
|
} |
83 |
|
|
84 |
private static native RawData allocateImpl (int capacity); |
private static native RawData allocateImpl (int capacity); |
85 |
private static native void freeImpl (RawData address); |
private static native void freeImpl (RawData address); |
86 |
|
|