org.eclipse.jetty.io.Buffer.putIndex()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(230)

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

Buffer.putIndex介绍

[英]The index of the first element that should not be read.
[中]不应读取的第一个元素的索引。

代码示例

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

public Buffer getRequestContentChunk(Buffer buffer) throws IOException
{
  synchronized (this)
  {
    if (_requestContentSource!=null)
    {
      if (buffer == null)
        buffer = new ByteArrayBuffer(8192); // TODO configure
      int space = buffer.space();
      int length = _requestContentSource.read(buffer.array(),buffer.putIndex(),space);
      if (length >= 0)
      {
        buffer.setPutIndex(buffer.putIndex()+length);
        return buffer;
      }
    }
    return null;
  }
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

protected int gatheringFlush(Buffer header, ByteBuffer bbuf0, Buffer buffer, ByteBuffer bbuf1) throws IOException
{
  int length;
  synchronized(this)
  {
    // Adjust position indexs of buf0 and buf1
    bbuf0=bbuf0.asReadOnlyBuffer();
    bbuf0.position(header.getIndex());
    bbuf0.limit(header.putIndex());
    bbuf1=bbuf1.asReadOnlyBuffer();
    bbuf1.position(buffer.getIndex());
    bbuf1.limit(buffer.putIndex());
    _gather2[0]=bbuf0;
    _gather2[1]=bbuf1;
    // do the gathering write.
    length=(int)((GatheringByteChannel)_channel).write(_gather2);
    int hl=header.length();
    if (length>hl)
    {
      header.clear();
      buffer.skip(length-hl);
    }
    else if (length>0)
    {
      header.skip(length);
    }
  }
  return length;
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server

protected int gatheringFlush(Buffer header, ByteBuffer bbuf0, Buffer buffer, ByteBuffer bbuf1) throws IOException
{
  int length;
  synchronized(this)
  {
    // Adjust position indexs of buf0 and buf1
    bbuf0=bbuf0.asReadOnlyBuffer();
    bbuf0.position(header.getIndex());
    bbuf0.limit(header.putIndex());
    bbuf1=bbuf1.asReadOnlyBuffer();
    bbuf1.position(buffer.getIndex());
    bbuf1.limit(buffer.putIndex());
    _gather2[0]=bbuf0;
    _gather2[1]=bbuf1;
    // do the gathering write.
    length=(int)((GatheringByteChannel)_channel).write(_gather2);
    int hl=header.length();
    if (length>hl)
    {
      header.clear();
      buffer.skip(length-hl);
    }
    else if (length>0)
    {
      header.skip(length);
    }
  }
  return length;
}

代码示例来源:origin: org.eclipse.jetty.spdy/spdy-jetty-http

private DataInfo toDataInfo(Buffer buffer, boolean close)
{
  if (buffer instanceof ByteArrayBuffer)
    return new BytesDataInfo(buffer.array(), buffer.getIndex(), buffer.length(), close);
  if (buffer instanceof NIOBuffer)
  {
    ByteBuffer byteBuffer = ((NIOBuffer)buffer).getByteBuffer();
    byteBuffer.limit(buffer.putIndex());
    byteBuffer.position(buffer.getIndex());
    return new ByteBufferDataInfo(byteBuffer, close);
  }
  return new BytesDataInfo(buffer.asArray(), close);
}

代码示例来源:origin: org.eclipse.jetty.spdy/spdy-jetty-http

private DataInfo toDataInfo(Buffer buffer, boolean close)
{
  if (buffer instanceof ByteArrayBuffer)
    return new BytesDataInfo(buffer.array(), buffer.getIndex(), buffer.length(), close);
  if (buffer instanceof NIOBuffer)
  {
    ByteBuffer byteBuffer = ((NIOBuffer)buffer).getByteBuffer();
    byteBuffer.limit(buffer.putIndex());
    byteBuffer.position(buffer.getIndex());
    return new ByteBufferDataInfo(byteBuffer, close);
  }
  return new BytesDataInfo(buffer.asArray(), close);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server

public static boolean isPrefix(Buffer prefix,Buffer buffer)
{
  if (prefix.length()>buffer.length())
    return false;
  int bi=buffer.getIndex();
  for (int i=prefix.getIndex(); i<prefix.putIndex();i++)
    if (prefix.peek(i)!=buffer.peek(bi++))
      return false;
  return true;
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

public static boolean isPrefix(Buffer prefix,Buffer buffer)
{
  if (prefix.length()>buffer.length())
    return false;
  int bi=buffer.getIndex();
  for (int i=prefix.getIndex(); i<prefix.putIndex();i++)
    if (prefix.peek(i)!=buffer.peek(bi++))
      return false;
  return true;
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp

public static boolean isPrefix(Buffer prefix,Buffer buffer)
{
  if (prefix.length()>buffer.length())
    return false;
  int bi=buffer.getIndex();
  for (int i=prefix.getIndex(); i<prefix.putIndex();i++)
    if (prefix.peek(i)!=buffer.peek(bi++))
      return false;
  return true;
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus

public static boolean isPrefix(Buffer prefix,Buffer buffer)
{
  if (prefix.length()>buffer.length())
    return false;
  int bi=buffer.getIndex();
  for (int i=prefix.getIndex(); i<prefix.putIndex();i++)
    if (prefix.peek(i)!=buffer.peek(bi++))
      return false;
  return true;
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

public View(Buffer buffer)
{
  super(READWRITE,!buffer.isImmutable());
  _buffer=buffer.buffer();
  setPutIndex(buffer.putIndex());
  setGetIndex(buffer.getIndex());
  setMarkIndex(buffer.markIndex());
  _access=buffer.isReadOnly()?READONLY:READWRITE;
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server

public View(Buffer buffer)
{
  super(READWRITE,!buffer.isImmutable());
  _buffer=buffer.buffer();
  setPutIndex(buffer.putIndex());
  setGetIndex(buffer.getIndex());
  setMarkIndex(buffer.markIndex());
  _access=buffer.isReadOnly()?READONLY:READWRITE;
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus

public View(Buffer buffer)
{
  super(READWRITE,!buffer.isImmutable());
  _buffer=buffer.buffer();
  setPutIndex(buffer.putIndex());
  setGetIndex(buffer.getIndex());
  setMarkIndex(buffer.markIndex());
  _access=buffer.isReadOnly()?READONLY:READWRITE;
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server

/**
 * Update view to buffer
 */
public void update(Buffer buffer)
{
  _access=READWRITE;
  _buffer=buffer.buffer();
  setGetIndex(0);
  setPutIndex(buffer.putIndex());
  setGetIndex(buffer.getIndex());
  setMarkIndex(buffer.markIndex());
  _access=buffer.isReadOnly()?READONLY:READWRITE;
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp

public View(Buffer buffer)
{
  super(READWRITE,!buffer.isImmutable());
  _buffer=buffer.buffer();
  setPutIndex(buffer.putIndex());
  setGetIndex(buffer.getIndex());
  setMarkIndex(buffer.markIndex());
  _access=buffer.isReadOnly()?READONLY:READWRITE;
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp

/**
 * Update view to buffer
 */
public void update(Buffer buffer)
{
  _access=READWRITE;
  _buffer=buffer.buffer();
  setGetIndex(0);
  setPutIndex(buffer.putIndex());
  setGetIndex(buffer.getIndex());
  setMarkIndex(buffer.markIndex());
  _access=buffer.isReadOnly()?READONLY:READWRITE;
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

/**
 * Update view to buffer
 */
public void update(Buffer buffer)
{
  _access=READWRITE;
  _buffer=buffer.buffer();
  setGetIndex(0);
  setPutIndex(buffer.putIndex());
  setGetIndex(buffer.getIndex());
  setMarkIndex(buffer.markIndex());
  _access=buffer.isReadOnly()?READONLY:READWRITE;
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus

/**
 * Update view to buffer
 */
public void update(Buffer buffer)
{
  _access=READWRITE;
  _buffer=buffer.buffer();
  setGetIndex(0);
  setPutIndex(buffer.putIndex());
  setGetIndex(buffer.getIndex());
  setMarkIndex(buffer.markIndex());
  _access=buffer.isReadOnly()?READONLY:READWRITE;
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

int bi=b.putIndex();
for (int i = putIndex(); i-->get;)

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus

int bi=b.putIndex();
for (int i = putIndex(); i-->get;)

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server

int bi=b.putIndex();
for (int i = putIndex(); i-->get;)

相关文章