Package com.tangosol.util
Class Unsafe
java.lang.Object
com.tangosol.util.Unsafe
A collection of "back-door" utilities and helpers used internally.
This class is not intended to be used externally and any usage of this class promises nothing more than un-deterministic behavior which may or may not remain consistent from release to release.
- Author:
- rhl 2012.12.20
-
Method Summary
Modifier and TypeMethodDescriptionintgetArrayOffset(Binary bin) Return the offset into theunderlying byte arrayfor the specified Binary.byte[]getByteArray(Binary bin) Return the underlying byte[] for the specified Binary.static UnsafeReturn the singletonUnsafeinstance.newBinary(byte[] ab, int of, int cb) Return a newBinaryinstance backed by the specified byte[] beginning at the specified offset and of the specified length.
-
Method Details
-
getUnsafe
Return the singletonUnsafeinstance. This method may only be called internally. The caller should cache the result.- Returns:
- the singleton instance
-
getByteArray
Return the underlying byte[] for the specified Binary.Note: unlike the
AbstractReadBuffer.toByteArray()method, this method does not create a copy of the underlying array; it is the caller's responsibility not to mutate the contents of the returned array.- Parameters:
bin- the binary- Returns:
- the underlying byte[]
-
getArrayOffset
Return the offset into theunderlying byte arrayfor the specified Binary.- Parameters:
bin- the binary- Returns:
- the offset into the underlying byte[]
-
newBinary
Return a newBinaryinstance backed by the specified byte[] beginning at the specified offset and of the specified length.Note: unlike the
analagous constructor, this method does not create a copy of the passed array; it is the caller's responsibility not to mutate the contents of the array.- Parameters:
ab- the byte arrayof- the starting offsetcb- the length of the binary- Returns:
- a new Binary based on the specified array
-