Tabnine Logo
WrapperAware.wrap
Code IndexAdd Tabnine to your IDE (free)

How to use
wrap
method
in
org.glassfish.grizzly.memory.WrapperAware

Best Java code snippets using org.glassfish.grizzly.memory.WrapperAware.wrap (Showing top 20 results out of 315)

origin: javaee/grizzly

/**
 * Returns {@link Buffer}, which wraps the {@link ByteBuffer}.
 *
 * @param memoryManager {@link MemoryManager}, which should be
 *                       used for wrapping.
 * @param byteBuffer {@link ByteBuffer} to wrap
 *
 * @return {@link Buffer} wrapper on top of passed {@link ByteBuffer}.
 */
public static Buffer wrap(final MemoryManager memoryManager,
    final ByteBuffer byteBuffer) {
  if (memoryManager instanceof WrapperAware) {
    return ((WrapperAware) memoryManager).wrap(byteBuffer);
  } else if (byteBuffer.hasArray()) {
    return wrap(memoryManager, byteBuffer.array(),
        byteBuffer.arrayOffset() + byteBuffer.position(),
        byteBuffer.remaining());
  }
  throw new IllegalStateException("Can not wrap ByteBuffer");
}
origin: javaee/grizzly

/**
 * Returns {@link Buffer}, which wraps the {@link ByteBuffer}.
 *
 * @param memoryManager {@link MemoryManager}, which should be
 *                       used for wrapping.
 * @param byteBuffer {@link ByteBuffer} to wrap
 *
 * @return {@link Buffer} wrapper on top of passed {@link ByteBuffer}.
 */
public static Buffer wrap(final MemoryManager memoryManager,
    final ByteBuffer byteBuffer) {
  if (memoryManager instanceof WrapperAware) {
    return ((WrapperAware) memoryManager).wrap(byteBuffer);
  } else if (byteBuffer.hasArray()) {
    return wrap(memoryManager, byteBuffer.array(),
        byteBuffer.arrayOffset() + byteBuffer.position(),
        byteBuffer.remaining());
  }
  throw new IllegalStateException("Can not wrap ByteBuffer");
}
origin: org.glassfish.grizzly/grizzly-websockets-server

/**
 * Returns {@link Buffer}, which wraps the {@link ByteBuffer}.
 *
 * @param memoryManager {@link MemoryManager}, which should be
 *                       used for wrapping.
 * @param byteBuffer {@link ByteBuffer} to wrap
 *
 * @return {@link Buffer} wrapper on top of passed {@link ByteBuffer}.
 */
public static Buffer wrap(final MemoryManager memoryManager,
    final ByteBuffer byteBuffer) {
  if (memoryManager instanceof WrapperAware) {
    return ((WrapperAware) memoryManager).wrap(byteBuffer);
  } else if (byteBuffer.hasArray()) {
    return wrap(memoryManager, byteBuffer.array(),
        byteBuffer.arrayOffset() + byteBuffer.position(),
        byteBuffer.remaining());
  }
  throw new IllegalStateException("Can not wrap ByteBuffer");
}
origin: javaee/grizzly

/**
 * Returns {@link Buffer}, which wraps the {@link ByteBuffer}.
 *
 * @param memoryManager {@link MemoryManager}, which should be
 *                       used for wrapping.
 * @param byteBuffer {@link ByteBuffer} to wrap
 *
 * @return {@link Buffer} wrapper on top of passed {@link ByteBuffer}.
 */
public static Buffer wrap(final MemoryManager memoryManager,
    final ByteBuffer byteBuffer) {
  if (memoryManager instanceof WrapperAware) {
    return ((WrapperAware) memoryManager).wrap(byteBuffer);
  } else if (byteBuffer.hasArray()) {
    return wrap(memoryManager, byteBuffer.array(),
        byteBuffer.arrayOffset() + byteBuffer.position(),
        byteBuffer.remaining());
  }
  throw new IllegalStateException("Can not wrap ByteBuffer");
}
origin: javaee/grizzly

/**
 * Returns {@link Buffer}, which wraps the {@link ByteBuffer}.
 *
 * @param memoryManager {@link MemoryManager}, which should be
 *                       used for wrapping.
 * @param byteBuffer {@link ByteBuffer} to wrap
 *
 * @return {@link Buffer} wrapper on top of passed {@link ByteBuffer}.
 */
public static Buffer wrap(final MemoryManager memoryManager,
    final ByteBuffer byteBuffer) {
  if (memoryManager instanceof WrapperAware) {
    return ((WrapperAware) memoryManager).wrap(byteBuffer);
  } else if (byteBuffer.hasArray()) {
    return wrap(memoryManager, byteBuffer.array(),
        byteBuffer.arrayOffset() + byteBuffer.position(),
        byteBuffer.remaining());
  }
  throw new IllegalStateException("Can not wrap ByteBuffer");
}
origin: javaee/grizzly

/**
 * Returns {@link Buffer}, which wraps the {@link ByteBuffer}.
 *
 * @param memoryManager {@link MemoryManager}, which should be
 *                       used for wrapping.
 * @param byteBuffer {@link ByteBuffer} to wrap
 *
 * @return {@link Buffer} wrapper on top of passed {@link ByteBuffer}.
 */
public static Buffer wrap(final MemoryManager memoryManager,
    final ByteBuffer byteBuffer) {
  if (memoryManager instanceof WrapperAware) {
    return ((WrapperAware) memoryManager).wrap(byteBuffer);
  } else if (byteBuffer.hasArray()) {
    return wrap(memoryManager, byteBuffer.array(),
        byteBuffer.arrayOffset() + byteBuffer.position(),
        byteBuffer.remaining());
  }
  throw new IllegalStateException("Can not wrap ByteBuffer");
}
origin: javaee/grizzly

/**
 * Returns {@link Buffer}, which wraps the {@link ByteBuffer}.
 *
 * @param memoryManager {@link MemoryManager}, which should be
 *                       used for wrapping.
 * @param byteBuffer {@link ByteBuffer} to wrap
 *
 * @return {@link Buffer} wrapper on top of passed {@link ByteBuffer}.
 */
public static Buffer wrap(final MemoryManager memoryManager,
    final ByteBuffer byteBuffer) {
  if (memoryManager instanceof WrapperAware) {
    return ((WrapperAware) memoryManager).wrap(byteBuffer);
  } else if (byteBuffer.hasArray()) {
    return wrap(memoryManager, byteBuffer.array(),
        byteBuffer.arrayOffset() + byteBuffer.position(),
        byteBuffer.remaining());
  }
  throw new IllegalStateException("Can not wrap ByteBuffer");
}
origin: org.mule.glassfish.grizzly/grizzly-framework

/**
 * Returns {@link Buffer}, which wraps the {@link ByteBuffer}.
 *
 * @param memoryManager {@link MemoryManager}, which should be
 *                       used for wrapping.
 * @param byteBuffer {@link ByteBuffer} to wrap
 *
 * @return {@link Buffer} wrapper on top of passed {@link ByteBuffer}.
 */
public static Buffer wrap(final MemoryManager memoryManager,
    final ByteBuffer byteBuffer) {
  if (memoryManager instanceof WrapperAware) {
    return ((WrapperAware) memoryManager).wrap(byteBuffer);
  } else if (byteBuffer.hasArray()) {
    return wrap(memoryManager, byteBuffer.array(),
        byteBuffer.arrayOffset() + byteBuffer.position(),
        byteBuffer.remaining());
  }
  throw new IllegalStateException("Can not wrap ByteBuffer");
}
origin: org.glassfish.grizzly/grizzly-http-server-core

/**
 * Returns {@link Buffer}, which wraps the {@link ByteBuffer}.
 *
 * @param memoryManager {@link MemoryManager}, which should be
 *                       used for wrapping.
 * @param byteBuffer {@link ByteBuffer} to wrap
 *
 * @return {@link Buffer} wrapper on top of passed {@link ByteBuffer}.
 */
public static Buffer wrap(final MemoryManager memoryManager,
    final ByteBuffer byteBuffer) {
  if (memoryManager instanceof WrapperAware) {
    return ((WrapperAware) memoryManager).wrap(byteBuffer);
  } else if (byteBuffer.hasArray()) {
    return wrap(memoryManager, byteBuffer.array(),
        byteBuffer.arrayOffset() + byteBuffer.position(),
        byteBuffer.remaining());
  }
  throw new IllegalStateException("Can not wrap ByteBuffer");
}
origin: javaee/grizzly

/**
 * Returns {@link Buffer}, which wraps the {@link ByteBuffer}.
 *
 * @param memoryManager {@link MemoryManager}, which should be
 *                       used for wrapping.
 * @param byteBuffer {@link ByteBuffer} to wrap
 *
 * @return {@link Buffer} wrapper on top of passed {@link ByteBuffer}.
 */
public static Buffer wrap(final MemoryManager memoryManager,
    final ByteBuffer byteBuffer) {
  if (memoryManager instanceof WrapperAware) {
    return ((WrapperAware) memoryManager).wrap(byteBuffer);
  } else if (byteBuffer.hasArray()) {
    return wrap(memoryManager, byteBuffer.array(),
        byteBuffer.arrayOffset() + byteBuffer.position(),
        byteBuffer.remaining());
  }
  throw new IllegalStateException("Can not wrap ByteBuffer");
}
origin: javaee/grizzly

/**
 * Returns {@link Buffer}, which wraps the {@link ByteBuffer}.
 *
 * @param memoryManager {@link MemoryManager}, which should be
 *                       used for wrapping.
 * @param byteBuffer {@link ByteBuffer} to wrap
 *
 * @return {@link Buffer} wrapper on top of passed {@link ByteBuffer}.
 */
public static Buffer wrap(final MemoryManager memoryManager,
    final ByteBuffer byteBuffer) {
  if (memoryManager instanceof WrapperAware) {
    return ((WrapperAware) memoryManager).wrap(byteBuffer);
  } else if (byteBuffer.hasArray()) {
    return wrap(memoryManager, byteBuffer.array(),
        byteBuffer.arrayOffset() + byteBuffer.position(),
        byteBuffer.remaining());
  }
  throw new IllegalStateException("Can not wrap ByteBuffer");
}
origin: org.glassfish.grizzly/grizzly-core

/**
 * Returns {@link Buffer}, which wraps the {@link ByteBuffer}.
 *
 * @param memoryManager {@link MemoryManager}, which should be
 *                       used for wrapping.
 * @param byteBuffer {@link ByteBuffer} to wrap
 *
 * @return {@link Buffer} wrapper on top of passed {@link ByteBuffer}.
 */
public static Buffer wrap(final MemoryManager memoryManager,
    final ByteBuffer byteBuffer) {
  if (memoryManager instanceof WrapperAware) {
    return ((WrapperAware) memoryManager).wrap(byteBuffer);
  } else if (byteBuffer.hasArray()) {
    return wrap(memoryManager, byteBuffer.array(),
        byteBuffer.arrayOffset() + byteBuffer.position(),
        byteBuffer.remaining());
  }
  throw new IllegalStateException("Can not wrap ByteBuffer");
}
origin: javaee/grizzly

/**
 * Returns {@link Buffer}, which wraps the part of byte array with
 * specific offset and length.
 *
 * @param memoryManager {@link MemoryManager}, which should be
 *                       used for wrapping.
 * @param array byte array to wrap
 * @param offset byte buffer offset
 * @param length byte buffer length
 *
 * @return {@link Buffer} wrapper on top of passed byte array.
 */
public static Buffer wrap(MemoryManager memoryManager,
    final byte[] array, final int offset, final int length) {
  if (memoryManager == null) {
    memoryManager = getDefaultMemoryManager();
  }
  if (memoryManager instanceof WrapperAware) {
    return ((WrapperAware) memoryManager).wrap(array, offset, length);
  }
  final Buffer buffer = memoryManager.allocate(length);
  buffer.put(array, offset, length);
  buffer.flip();
  return buffer;
}
origin: org.glassfish.grizzly/grizzly-core

/**
 * Returns {@link Buffer}, which wraps the part of byte array with
 * specific offset and length.
 *
 * @param memoryManager {@link MemoryManager}, which should be
 *                       used for wrapping.
 * @param array byte array to wrap
 * @param offset byte buffer offset
 * @param length byte buffer length
 *
 * @return {@link Buffer} wrapper on top of passed byte array.
 */
public static Buffer wrap(MemoryManager memoryManager,
    final byte[] array, final int offset, final int length) {
  if (memoryManager == null) {
    memoryManager = getDefaultMemoryManager();
  }
  if (memoryManager instanceof WrapperAware) {
    return ((WrapperAware) memoryManager).wrap(array, offset, length);
  }
  final Buffer buffer = memoryManager.allocate(length);
  buffer.put(array, offset, length);
  buffer.flip();
  return buffer;
}
origin: org.glassfish.grizzly/grizzly-websockets-server

/**
 * Returns {@link Buffer}, which wraps the part of byte array with
 * specific offset and length.
 *
 * @param memoryManager {@link MemoryManager}, which should be
 *                       used for wrapping.
 * @param array byte array to wrap
 * @param offset byte buffer offset
 * @param length byte buffer length
 *
 * @return {@link Buffer} wrapper on top of passed byte array.
 */
public static Buffer wrap(MemoryManager memoryManager,
    final byte[] array, final int offset, final int length) {
  if (memoryManager == null) {
    memoryManager = getDefaultMemoryManager();
  }
  if (memoryManager instanceof WrapperAware) {
    return ((WrapperAware) memoryManager).wrap(array, offset, length);
  }
  final Buffer buffer = memoryManager.allocate(length);
  buffer.put(array, offset, length);
  buffer.flip();
  return buffer;
}
origin: org.mule.glassfish.grizzly/grizzly-framework

/**
 * Returns {@link Buffer}, which wraps the part of byte array with
 * specific offset and length.
 *
 * @param memoryManager {@link MemoryManager}, which should be
 *                       used for wrapping.
 * @param array byte array to wrap
 * @param offset byte buffer offset
 * @param length byte buffer length
 *
 * @return {@link Buffer} wrapper on top of passed byte array.
 */
public static Buffer wrap(MemoryManager memoryManager,
    final byte[] array, final int offset, final int length) {
  if (memoryManager == null) {
    memoryManager = getDefaultMemoryManager();
  }
  if (memoryManager instanceof WrapperAware) {
    return ((WrapperAware) memoryManager).wrap(array, offset, length);
  }
  final Buffer buffer = memoryManager.allocate(length);
  buffer.put(array, offset, length);
  buffer.flip();
  return buffer;
}
origin: javaee/grizzly

/**
 * Returns {@link Buffer}, which wraps the part of byte array with
 * specific offset and length.
 *
 * @param memoryManager {@link MemoryManager}, which should be
 *                       used for wrapping.
 * @param array byte array to wrap
 * @param offset byte buffer offset
 * @param length byte buffer length
 *
 * @return {@link Buffer} wrapper on top of passed byte array.
 */
public static Buffer wrap(MemoryManager memoryManager,
    final byte[] array, final int offset, final int length) {
  if (memoryManager == null) {
    memoryManager = getDefaultMemoryManager();
  }
  if (memoryManager instanceof WrapperAware) {
    return ((WrapperAware) memoryManager).wrap(array, offset, length);
  }
  final Buffer buffer = memoryManager.allocate(length);
  buffer.put(array, offset, length);
  buffer.flip();
  return buffer;
}
origin: javaee/grizzly

/**
 * Returns {@link Buffer}, which wraps the part of byte array with
 * specific offset and length.
 *
 * @param memoryManager {@link MemoryManager}, which should be
 *                       used for wrapping.
 * @param array byte array to wrap
 * @param offset byte buffer offset
 * @param length byte buffer length
 *
 * @return {@link Buffer} wrapper on top of passed byte array.
 */
public static Buffer wrap(MemoryManager memoryManager,
    final byte[] array, final int offset, final int length) {
  if (memoryManager == null) {
    memoryManager = getDefaultMemoryManager();
  }
  if (memoryManager instanceof WrapperAware) {
    return ((WrapperAware) memoryManager).wrap(array, offset, length);
  }
  final Buffer buffer = memoryManager.allocate(length);
  buffer.put(array, offset, length);
  buffer.flip();
  return buffer;
}
origin: javaee/grizzly

/**
 * Returns {@link Buffer}, which wraps the part of byte array with
 * specific offset and length.
 *
 * @param memoryManager {@link MemoryManager}, which should be
 *                       used for wrapping.
 * @param array byte array to wrap
 * @param offset byte buffer offset
 * @param length byte buffer length
 *
 * @return {@link Buffer} wrapper on top of passed byte array.
 */
public static Buffer wrap(MemoryManager memoryManager,
    final byte[] array, final int offset, final int length) {
  if (memoryManager == null) {
    memoryManager = getDefaultMemoryManager();
  }
  if (memoryManager instanceof WrapperAware) {
    return ((WrapperAware) memoryManager).wrap(array, offset, length);
  }
  final Buffer buffer = memoryManager.allocate(length);
  buffer.put(array, offset, length);
  buffer.flip();
  return buffer;
}
origin: javaee/grizzly

/**
 * Returns {@link Buffer}, which wraps the part of byte array with
 * specific offset and length.
 *
 * @param memoryManager {@link MemoryManager}, which should be
 *                       used for wrapping.
 * @param array byte array to wrap
 * @param offset byte buffer offset
 * @param length byte buffer length
 *
 * @return {@link Buffer} wrapper on top of passed byte array.
 */
public static Buffer wrap(MemoryManager memoryManager,
    final byte[] array, final int offset, final int length) {
  if (memoryManager == null) {
    memoryManager = getDefaultMemoryManager();
  }
  if (memoryManager instanceof WrapperAware) {
    return ((WrapperAware) memoryManager).wrap(array, offset, length);
  }
  final Buffer buffer = memoryManager.allocate(length);
  buffer.put(array, offset, length);
  buffer.flip();
  return buffer;
}
org.glassfish.grizzly.memoryWrapperAwarewrap

Javadoc

Returns Buffer, which wraps the String.

Popular methods of WrapperAware

    Popular in Java

    • Creating JSON documents from java classes using gson
    • getResourceAsStream (ClassLoader)
    • putExtra (Intent)
    • findViewById (Activity)
    • BufferedReader (java.io)
      Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
    • HashMap (java.util)
      HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
    • Callable (java.util.concurrent)
      A task that returns a result and may throw an exception. Implementors define a single method with no
    • Manifest (java.util.jar)
      The Manifest class is used to obtain attribute information for a JarFile and its entries.
    • JTable (javax.swing)
    • Logger (org.apache.log4j)
      This is the central class in the log4j package. Most logging operations, except configuration, are d
    • Top plugins for Android Studio
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now