// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_BOOLEAN_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_BYTE_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_CHAR_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_DOUBLE_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_FLOAT_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_INT_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_LONG_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_SHORT_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int BOOLEAN_SHIFT   = 0;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int BYTE_SHIFT      = 0;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int CHAR_SHIFT      = 1;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int DOUBLE_SHIFT    = 3;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int FLOAT_SHIFT     = 2;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int INT_SHIFT       = 2;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int LONG_SHIFT      = 3;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final String LS = System.getProperty("line.separator");
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int SHORT_SHIFT     = 1;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static void assertBounds(final long reqOff, final long reqLen, final long allocSize) {
//   assert ((reqOff | reqLen | (reqOff + reqLen) | (allocSize - (reqOff + reqLen))) >= 0) :
//     "reqOffset: " + reqOff + ", reqLength: " + reqLen
//     + ", (reqOff + reqLen): " + (reqOff + reqLen) + ", allocSize: " + allocSize;
// }
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final Unsafe unsafe;


import static com.yahoo.memory4.UnsafeUtil.ARRAY_BOOLEAN_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_BYTE_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_CHAR_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_DOUBLE_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_FLOAT_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_INT_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_LONG_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_SHORT_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.BOOLEAN_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.BYTE_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.CHAR_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.DOUBLE_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.FLOAT_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.INT_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.LONG_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.LS;
import static com.yahoo.memory4.UnsafeUtil.SHORT_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.assertBounds;
import static com.yahoo.memory4.UnsafeUtil.unsafe;
import java.io.File;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
   * @return true if the backing resource is read only
   */
  public abstract boolean isResourceReadOnly();

  /**
   * Returns true if this Memory is valid() and has not been closed.
   * @return true if this Memory is valid() and has not been closed.
   */
  public abstract boolean isValid();

  /**
   * Returns a formatted hex string of a range of this Memory.
   * Used primarily for testing.
   * @param header descriptive header
   * @param offsetBytes offset bytes relative to this Memory start
   * @param lengthBytes number of bytes to convert to a hex string
   * @return a formatted hex string in a human readable array
   */
  public abstract String toHexString(String header, long offsetBytes, int lengthBytes);

  /**
   * Returns a formatted hex string of an area of this Memory.
   * Used primarily for testing.
   * @param preamble a descriptive header
   * @param offsetBytes offset bytes relative to the Memory start
   * @param lengthBytes number of bytes to convert to a hex string
   * @return a formatted hex string in a human readable array
   */
  static String toHex(final String preamble, final long offsetBytes, final int lengthBytes,
      final MemoryState state) {
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_BOOLEAN_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_BYTE_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_CHAR_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_DOUBLE_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_FLOAT_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_INT_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_LONG_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_SHORT_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int BOOLEAN_SHIFT   = 0;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int BYTE_SHIFT      = 0;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int CHAR_SHIFT      = 1;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int DOUBLE_SHIFT    = 3;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int FLOAT_SHIFT     = 2;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int INT_SHIFT       = 2;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int LONG_SHIFT      = 3;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final String LS = System.getProperty("line.separator");
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int SHORT_SHIFT     = 1;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static void assertBounds(final long reqOff, final long reqLen, final long allocSize) {
//   assert ((reqOff | reqLen | (reqOff + reqLen) | (allocSize - (reqOff + reqLen))) >= 0) :
//     "reqOffset: " + reqOff + ", reqLength: " + reqLen
//     + ", (reqOff + reqLen): " + (reqOff + reqLen) + ", allocSize: " + allocSize;
// }
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final Unsafe unsafe;


// Path: src/main/java/com/yahoo/memory4/Memory.java
import static com.yahoo.memory4.UnsafeUtil.ARRAY_BOOLEAN_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_BYTE_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_CHAR_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_DOUBLE_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_FLOAT_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_INT_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_LONG_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_SHORT_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.BOOLEAN_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.BYTE_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.CHAR_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.DOUBLE_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.FLOAT_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.INT_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.LONG_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.LS;
import static com.yahoo.memory4.UnsafeUtil.SHORT_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.assertBounds;
import static com.yahoo.memory4.UnsafeUtil.unsafe;
import java.io.File;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

   * @return true if the backing resource is read only
   */
  public abstract boolean isResourceReadOnly();

  /**
   * Returns true if this Memory is valid() and has not been closed.
   * @return true if this Memory is valid() and has not been closed.
   */
  public abstract boolean isValid();

  /**
   * Returns a formatted hex string of a range of this Memory.
   * Used primarily for testing.
   * @param header descriptive header
   * @param offsetBytes offset bytes relative to this Memory start
   * @param lengthBytes number of bytes to convert to a hex string
   * @return a formatted hex string in a human readable array
   */
  public abstract String toHexString(String header, long offsetBytes, int lengthBytes);

  /**
   * Returns a formatted hex string of an area of this Memory.
   * Used primarily for testing.
   * @param preamble a descriptive header
   * @param offsetBytes offset bytes relative to the Memory start
   * @param lengthBytes number of bytes to convert to a hex string
   * @return a formatted hex string in a human readable array
   */
  static String toHex(final String preamble, final long offsetBytes, final int lengthBytes,
      final MemoryState state) {
    assertBounds(offsetBytes, lengthBytes, state.getCapacity());