gpt4 book ai didi

com.sun.grizzly.util.WorkerThread.getByteBuffer()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 23:29:05 28 4
gpt4 key购买 nike

本文整理了Java中com.sun.grizzly.util.WorkerThread.getByteBuffer()方法的一些代码示例,展示了WorkerThread.getByteBuffer()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorkerThread.getByteBuffer()方法的具体详情如下:
包路径:com.sun.grizzly.util.WorkerThread
类名称:WorkerThread
方法名:getByteBuffer

WorkerThread.getByteBuffer介绍

[英]Return the ByteBuffer shared this thread
[中]返回此线程共享的字节缓冲区

代码示例

代码示例来源:origin: org.glassfish.external/grizzly-module

/**
 * Re-enable the SelectionKey and make sure the ByteBuffer has been cleared.
 * @return <tt>true</tt> if the previous ProtocolFilter postExecute method
 *         needs to be invoked.
 */
public boolean postExecute(Context ctx) throws IOException {
  ctx.setKeyRegistrationState(Context.KeyRegistrationState.REGISTER);
  ((WorkerThread)Thread.currentThread()).getByteBuffer().clear();
  return true;
}

代码示例来源:origin: com.sun.grizzly/grizzly-portunif

public ByteBuffer getByteBuffer() {
  return workerThread().getByteBuffer();
}

代码示例来源:origin: org.glassfish.external/grizzly-module

public ByteBuffer getByteBuffer() {
  return workerThread().getByteBuffer();
}

代码示例来源:origin: org.glassfish.external/grizzly-module

public boolean execute(Context ctx) throws IOException {
  final WorkerThread workerThread = ((WorkerThread) Thread.currentThread());
  ByteBuffer byteBuffer = workerThread.getByteBuffer();
  int pos = byteBuffer.position();
  int limit = byteBuffer.limit();
  try {
    byteBuffer.flip();
    byte[] array;
    int arrayOffset;
    int arrayLength = byteBuffer.remaining();
    if (byteBuffer.hasArray()) {
      array = byteBuffer.array();
      arrayOffset = byteBuffer.arrayOffset();
    } else {
      array = new byte[arrayLength];
      byteBuffer.get(array);
      arrayOffset = 0;
    }
    System.out.println("Request: " + new String(array, arrayOffset, arrayLength));
  } finally {
    byteBuffer.position(pos);
    byteBuffer.limit(limit);
  }
  return true;
}

代码示例来源:origin: org.glassfish.external/grizzly-module

public boolean execute(Context ctx) throws IOException {
  final WorkerThread workerThread = ((WorkerThread)Thread.currentThread());
  ByteBuffer buffer = workerThread.getByteBuffer();
  buffer.flip();
  if (buffer.hasRemaining()) {
    // Store incoming data in byte[]
    byte[] data = new byte[buffer.remaining()];
    int position = buffer.position();
    buffer.get(data);
    buffer.position(position);
    SelectableChannel channel = ctx.getSelectionKey().channel();
    try {
      SSLOutputWriter.flushChannel(channel, buffer);
    } catch (IOException ex) {
      throw ex;
    }
  }
  
  buffer.clear();
  return false;
}

代码示例来源:origin: com.sun.grizzly/grizzly-config

HttpRedirector.redirectSSL(ctx,
                sslEngine,
                thread.getByteBuffer(),
                thread.getOutputBB(),
                redirectPort,
} else {
  HttpRedirector.redirect(ctx,
              thread.getByteBuffer(),
              redirectPort,
              redirectToSecure);
final ByteBuffer bb = thread.getByteBuffer();

代码示例来源:origin: org.glassfish.external/grizzly-module

public boolean execute(Context ctx) throws IOException {
  final WorkerThread workerThread = ((WorkerThread)Thread.currentThread());
  ByteBuffer buffer = workerThread.getByteBuffer();
  buffer.flip();
  if (buffer.hasRemaining()) {

代码示例来源:origin: com.sun.grizzly/grizzly-config

if (sslEngine == null) {
  return Utils.readWithTemporarySelector(key.channel(),
    thread.getByteBuffer(), timeout).bytesRead;
} else {
  ByteBuffer byteBuffer = thread.getByteBuffer();
  final ByteBuffer securedBuffer = thread.getInputBB();
  if (securedBuffer.position() > 0) {

代码示例来源:origin: org.glassfish.external/grizzly-module

final WorkerThread workerThread = 
    (WorkerThread)Thread.currentThread();
ByteBuffer byteBuffer = workerThread.getByteBuffer();
ByteBuffer outputBB = workerThread.getOutputBB();
ByteBuffer inputBB = workerThread.getInputBB();

代码示例来源:origin: com.sun.grizzly/grizzly-utils

final WorkerThread workerThread = 
    (WorkerThread)Thread.currentThread();
ByteBuffer byteBuffer = workerThread.getByteBuffer();
ByteBuffer outputBB = workerThread.getOutputBB();
ByteBuffer inputBB = workerThread.getInputBB();

代码示例来源:origin: org.glassfish.external/grizzly-module

public boolean execute(Context ctx) throws IOException {
  final WorkerThread workerThread = ((WorkerThread)Thread.currentThread());
  ByteBuffer buffer = workerThread.getByteBuffer();
  buffer.flip();
  if (buffer.hasRemaining()) {

代码示例来源:origin: com.sun.grizzly/grizzly-http-utils

final WorkerThread workerThread = 
    (WorkerThread)Thread.currentThread();
ByteBuffer byteBuffer = workerThread.getByteBuffer();
ByteBuffer outputBB = workerThread.getOutputBB();
ByteBuffer inputBB = workerThread.getInputBB();

代码示例来源:origin: org.glassfish.external/grizzly-module

/**
 * Get the peer certificate list by initiating a new handshake.
 * @param key {@link SelectionKey}
 * @param needClientAuth 
 * @return Object[] An array of X509Certificate.
 * @throws java.io.IOException 
 */
public static Object[] doPeerCertificateChain(SelectionKey key,
    boolean needClientAuth) throws IOException {
  
  final WorkerThread workerThread = 
      (WorkerThread)Thread.currentThread();
  ByteBuffer byteBuffer = workerThread.getByteBuffer();
  ByteBuffer inputBB = workerThread.getInputBB();
  ByteBuffer outputBB = workerThread.getOutputBB();
  SSLEngine sslEngine = workerThread.getSSLEngine();
  
  return SSLUtils.doPeerCertificateChain((SocketChannel) key.channel(), 
      byteBuffer, inputBB, outputBB, sslEngine, needClientAuth, 
      InputReader.getDefaultReadTimeout());
}

代码示例来源:origin: org.glassfish.external/grizzly-module

public boolean execute(Context ctx) throws IOException {
  final WorkerThread workerThread = ((WorkerThread) Thread.currentThread());
  ByteBuffer buffer = workerThread.getByteBuffer();
  buffer.flip();
  if (buffer.hasRemaining()) {

代码示例来源:origin: org.restlet.jse/org.restlet.ext.grizzly

.getByteBuffer();
byteBuffer.flip();

代码示例来源:origin: org.glassfish.external/grizzly-module

final WorkerThread workerThread = 
    (WorkerThread)Thread.currentThread();
ByteBuffer byteBuffer = workerThread.getByteBuffer();
ByteBuffer outputBB = workerThread.getOutputBB();
ByteBuffer inputBB = workerThread.getInputBB();

代码示例来源:origin: org.glassfish.external/grizzly-module

private static int doRead(SelectionKey key) {
  final WorkerThread workerThread =
      (WorkerThread) Thread.currentThread();
  ByteBuffer byteBuffer = workerThread.getByteBuffer();
  ByteBuffer outputBB = workerThread.getOutputBB();
  ByteBuffer inputBB = workerThread.getInputBB();

代码示例来源:origin: org.glassfish.external/grizzly-module

((WorkerThread)Thread.currentThread()).getByteBuffer();
try {
  socketAddress = (SocketAddress)ctx.getAttribute(UDP_SOCKETADDRESS);

代码示例来源:origin: org.glassfish.external/grizzly-module

((WorkerThread)Thread.currentThread()).getByteBuffer();
try {
  datagramChannel = (DatagramChannel)key.channel();

代码示例来源:origin: org.glassfish.external/grizzly-module

ByteBuffer byteBuffer = workerThread.getByteBuffer();
parser.startBuffer(byteBuffer);
if (!continueExecution) {

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com