org.glassfish.grizzly.memory.Buffers.slice()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(94)

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

Buffers.slice介绍

[英]Slice ByteBuffer of required size from big chunk. Passed chunk position will be changed, after the slicing (chunk.position += size).
[中]从大块中按所需大小切片ByteBuffer。切片后,传递的区块位置将发生更改(chunk.position+=size)。

代码示例

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

@Override
public ByteBuffer allocate(int size) {
  final ByteBuffer allocated = Buffers.slice(pool, size);
  return addHistory(allocated);
}

代码示例来源:origin: javaee/grizzly

@Override
public ByteBuffer allocate(int size) {
  final ByteBuffer allocated = Buffers.slice(pool, size);
  return addHistory(allocated);
}

代码示例来源:origin: javaee/grizzly

@Override
public ByteBuffer allocate(int size) {
  final ByteBuffer allocated = Buffers.slice(pool, size);
  return addHistory(allocated);
}

代码示例来源:origin: javaee/grizzly

@Override
public ByteBuffer allocate(int size) {
  final ByteBuffer allocated = Buffers.slice(pool, size);
  return addHistory(allocated);
}

代码示例来源:origin: javaee/grizzly

@Override
public ByteBuffer allocate(int size) {
  final ByteBuffer allocated = Buffers.slice(pool, size);
  return addHistory(allocated);
}

代码示例来源:origin: javaee/grizzly

@Override
public ByteBuffer allocate(int size) {
  final ByteBuffer allocated = Buffers.slice(pool, size);
  return addHistory(allocated);
}

代码示例来源:origin: javaee/grizzly

@Override
public ByteBuffer allocate(int size) {
  final ByteBuffer allocated = Buffers.slice(pool, size);
  return addHistory(allocated);
}

代码示例来源:origin: javaee/grizzly

@Override
public ByteBuffer allocate(int size) {
  final ByteBuffer allocated = Buffers.slice(pool, size);
  return addHistory(allocated);
}

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

@Override
public ByteBuffer allocate(int size) {
  final ByteBuffer allocated = Buffers.slice(pool, size);
  return addHistory(allocated);
}

代码示例来源:origin: org.mule.glassfish.grizzly/grizzly-framework

@Override
public ByteBuffer allocate(int size) {
  final ByteBuffer allocated = Buffers.slice(pool, size);
  return addHistory(allocated);
}

代码示例来源:origin: org.mule.glassfish.grizzly/grizzly-framework

@Override
public ByteBuffer reallocate(ByteBuffer oldByteBuffer, int newSize) {
  if (isLastAllocated(oldByteBuffer)
      && remaining() + oldByteBuffer.capacity() >= newSize) {
    lastAllocatedIndex--;
    pool.position(pool.position() - oldByteBuffer.capacity());
    final ByteBuffer newByteBuffer = Buffers.slice(pool, newSize);
    newByteBuffer.position(oldByteBuffer.position());
    return addHistory(newByteBuffer);
  }
  return null;
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

@Override
public ByteBuffer reallocate(ByteBuffer oldByteBuffer, int newSize) {
  if (isLastAllocated(oldByteBuffer)
      && remaining() + oldByteBuffer.capacity() >= newSize) {
    lastAllocatedIndex--;
    pool.position(pool.position() - oldByteBuffer.capacity());
    final ByteBuffer newByteBuffer = Buffers.slice(pool, newSize);
    newByteBuffer.position(oldByteBuffer.position());
    return addHistory(newByteBuffer);
  }
  return null;
}

代码示例来源:origin: javaee/grizzly

@Override
public ByteBuffer reallocate(ByteBuffer oldByteBuffer, int newSize) {
  if (isLastAllocated(oldByteBuffer)
      && remaining() + oldByteBuffer.capacity() >= newSize) {
    lastAllocatedIndex--;
    pool.position(pool.position() - oldByteBuffer.capacity());
    final ByteBuffer newByteBuffer = Buffers.slice(pool, newSize);
    newByteBuffer.position(oldByteBuffer.position());
    return addHistory(newByteBuffer);
  }
  return null;
}

代码示例来源:origin: javaee/grizzly

@Override
public ByteBuffer reallocate(ByteBuffer oldByteBuffer, int newSize) {
  if (isLastAllocated(oldByteBuffer)
      && remaining() + oldByteBuffer.capacity() >= newSize) {
    lastAllocatedIndex--;
    pool.position(pool.position() - oldByteBuffer.capacity());
    final ByteBuffer newByteBuffer = Buffers.slice(pool, newSize);
    newByteBuffer.position(oldByteBuffer.position());
    return addHistory(newByteBuffer);
  }
  return null;
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core

@Override
public ByteBuffer reallocate(ByteBuffer oldByteBuffer, int newSize) {
  if (isLastAllocated(oldByteBuffer)
      && remaining() + oldByteBuffer.capacity() >= newSize) {
    lastAllocatedIndex--;
    pool.position(pool.position() - oldByteBuffer.capacity());
    final ByteBuffer newByteBuffer = Buffers.slice(pool, newSize);
    newByteBuffer.position(oldByteBuffer.position());
    return addHistory(newByteBuffer);
  }
  return null;
}

代码示例来源:origin: javaee/grizzly

@Override
public ByteBuffer reallocate(ByteBuffer oldByteBuffer, int newSize) {
  if (isLastAllocated(oldByteBuffer)
      && remaining() + oldByteBuffer.capacity() >= newSize) {
    lastAllocatedIndex--;
    pool.position(pool.position() - oldByteBuffer.capacity());
    final ByteBuffer newByteBuffer = Buffers.slice(pool, newSize);
    newByteBuffer.position(oldByteBuffer.position());
    return addHistory(newByteBuffer);
  }
  return null;
}

代码示例来源:origin: javaee/grizzly

@Override
public ByteBuffer reallocate(ByteBuffer oldByteBuffer, int newSize) {
  if (isLastAllocated(oldByteBuffer)
      && remaining() + oldByteBuffer.capacity() >= newSize) {
    lastAllocatedIndex--;
    pool.position(pool.position() - oldByteBuffer.capacity());
    final ByteBuffer newByteBuffer = Buffers.slice(pool, newSize);
    newByteBuffer.position(oldByteBuffer.position());
    return addHistory(newByteBuffer);
  }
  return null;
}

代码示例来源:origin: javaee/grizzly

@Override
public ByteBuffer reallocate(ByteBuffer oldByteBuffer, int newSize) {
  if (isLastAllocated(oldByteBuffer)
      && remaining() + oldByteBuffer.capacity() >= newSize) {
    lastAllocatedIndex--;
    pool.position(pool.position() - oldByteBuffer.capacity());
    final ByteBuffer newByteBuffer = Buffers.slice(pool, newSize);
    newByteBuffer.position(oldByteBuffer.position());
    return addHistory(newByteBuffer);
  }
  return null;
}

代码示例来源:origin: javaee/grizzly

@Override
public ByteBuffer reallocate(ByteBuffer oldByteBuffer, int newSize) {
  if (isLastAllocated(oldByteBuffer)
      && remaining() + oldByteBuffer.capacity() >= newSize) {
    lastAllocatedIndex--;
    pool.position(pool.position() - oldByteBuffer.capacity());
    final ByteBuffer newByteBuffer = Buffers.slice(pool, newSize);
    newByteBuffer.position(oldByteBuffer.position());
    return addHistory(newByteBuffer);
  }
  return null;
}

代码示例来源:origin: javaee/grizzly

@Override
public ByteBuffer reallocate(ByteBuffer oldByteBuffer, int newSize) {
  if (isLastAllocated(oldByteBuffer)
      && remaining() + oldByteBuffer.capacity() >= newSize) {
    lastAllocatedIndex--;
    pool.position(pool.position() - oldByteBuffer.capacity());
    final ByteBuffer newByteBuffer = Buffers.slice(pool, newSize);
    newByteBuffer.position(oldByteBuffer.position());
    return addHistory(newByteBuffer);
  }
  return null;
}

相关文章