Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


com.tangosol.util
Class Unsafe

java.lang.Object
  extended by com.tangosol.util.Unsafe


public class Unsafe
extends java.lang.Object

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
 int getArrayOffset(Binary bin)
          Return the offset into the underlying byte[] for the specified Binary.
 byte[] getByteArray(Binary bin)
          Return the underlying byte[] for the specified Binary.
static Unsafe getUnsafe()
          Return the singleton Unsafe instance.
 Binary newBinary(byte[] ab, int of, int cb)
          Return a new Binary instance backed by the specified byte[] beginning at the specified offset and of the specified length.

 

Method Detail

getUnsafe

public static Unsafe getUnsafe()
Return the singleton Unsafe instance. This method may only be called internally.
Returns:
the singleton instance

getByteArray

public byte[] getByteArray(Binary bin)
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

public int getArrayOffset(Binary bin)
Return the offset into the underlying byte[] for the specified Binary.
Parameters:
bin - the binary
Returns:
the offset into the underlying byte[]

newBinary

public Binary newBinary(byte[] ab,
                        int of,
                        int cb)
Return a new Binary instance 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 array
of - the starting offset
cb - the length of the binary
Returns:
a new Binary based on the specified array

Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.