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

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

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

Buffer.space介绍

[英]the space remaining in the buffer.
[中]缓冲区中剩余的空间。

代码示例

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

@Override
public boolean isBufferFull()
{
  // Should we flush the buffers?
  return super.isBufferFull() || _bufferChunked || _bypass  || (_contentLength == HttpTokens.CHUNKED_CONTENT && _buffer != null && _buffer.space() < CHUNK_SPACE);
}

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

@Override
public boolean isBufferFull()
{
  // Should we flush the buffers?
  return super.isBufferFull() || _bufferChunked || _bypass  || (_contentLength == HttpTokens.CHUNKED_CONTENT && _buffer != null && _buffer.space() < CHUNK_SPACE);
}

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

@Override
public int prepareUncheckedAddContent() throws IOException
{
  initBuffer();
  return _buffer.space();
}

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

@Override
public boolean isBufferFull()
{
  // Should we flush the buffers?
  return super.isBufferFull() || _bufferChunked || _bypass  || (_contentLength == HttpTokens.CHUNKED_CONTENT && _buffer != null && _buffer.space() < CHUNK_SPACE);
}

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

@Override
public boolean isBufferFull()
{
  // Should we flush the buffers?
  return super.isBufferFull() || _bufferChunked || _bypass  || (_contentLength == HttpTokens.CHUNKED_CONTENT && _buffer != null && _buffer.space() < CHUNK_SPACE);
}

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

@Override
public boolean isBufferFull()
{
  // Should we flush the buffers?
  return super.isBufferFull() || _bufferChunked || _bypass  || (_contentLength == HttpTokens.CHUNKED_CONTENT && _buffer != null && _buffer.space() < CHUNK_SPACE);
}

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

public boolean isBufferFull()
{
  if (_buffer != null && _buffer.space()==0)
  {
    if (_buffer.length()==0 && !_buffer.isImmutable())
      _buffer.compact();
    return _buffer.space()==0;
  }
  return _content!=null && _content.length()>0;
}

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

public boolean isBufferFull()
{
  if (_buffer != null && _buffer.space()==0)
  {
    if (_buffer.length()==0 && !_buffer.isImmutable())
      _buffer.compact();
    return _buffer.space()==0;
  }
  return _content!=null && _content.length()>0;
}

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

public boolean isBufferFull()
{
  if (_buffer != null && _buffer.space()==0)
  {
    if (_buffer.length()==0 && !_buffer.isImmutable())
      _buffer.compact();
    return _buffer.space()==0;
  }
  return _content!=null && _content.length()>0;
}

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

public boolean isBufferFull()
{
  if (_buffer != null && _buffer.space()==0)
  {
    if (_buffer.length()==0 && !_buffer.isImmutable())
      _buffer.compact();
    return _buffer.space()==0;
  }
  return _content!=null && _content.length()>0;
}

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

public boolean isBufferFull()
{
  if (_buffer != null && _buffer.space()==0)
  {
    if (_buffer.length()==0 && !_buffer.isImmutable())
      _buffer.compact();
    return _buffer.space()==0;
  }
  return _content!=null && _content.length()>0;
}

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

private synchronized void bufferPut(byte datum, long blockFor) throws IOException
{
  if (_buffer==null)
    _buffer=_buffers.getDirectBuffer();
  _buffer.put(datum);
  if (_buffer.space() == 0)
    expelBuffer(blockFor);
}

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

private synchronized void bufferPut(byte datum, long blockFor) throws IOException
{
  if (_buffer==null)
    _buffer=_buffers.getDirectBuffer();
  _buffer.put(datum);
  if (_buffer.space() == 0)
    expelBuffer(blockFor);
}

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

private synchronized void bufferPut(byte datum, long blockFor) throws IOException
{
  if (_buffer==null)
    _buffer=_buffers.getDirectBuffer();
  _buffer.put(datum);
  if (_buffer.space() == 0)
    expelBuffer(blockFor);
}

代码示例来源: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

private synchronized int expelBuffer(long blockFor) throws IOException
{
  if (_buffer==null)
    return 0;
  int result = flushBuffer();
  _buffer.compact();
  if (!_endp.isBlocking())
  {
    while (_buffer.space()==0)
    {
      boolean ready = _endp.blockWritable(blockFor);
      if (!ready)
        throw new IOException("Write timeout");
      result += flushBuffer();
      _buffer.compact();
    }
  }
  return result;
}

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

private synchronized int expelBuffer(long blockFor) throws IOException
{
  if (_buffer==null)
    return 0;
  int result = flushBuffer();
  _buffer.compact();
  if (!_endp.isBlocking())
  {
    while (_buffer.space()==0)
    {
      boolean ready = _endp.blockWritable(blockFor);
      if (!ready)
        throw new IOException("Write timeout");
      result += flushBuffer();
      _buffer.compact();
    }
  }
  return result;
}

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

private synchronized int expelBuffer(long blockFor) throws IOException
{
  if (_buffer==null)
    return 0;
  int result = flushBuffer();
  _buffer.compact();
  if (!_endp.isBlocking())
  {
    while (_buffer.space()==0)
    {
      boolean ready = _endp.blockWritable(blockFor);
      if (!ready)
        throw new IOException("Write timeout");
      result += flushBuffer();
      _buffer.compact();
    }
  }
  return result;
}

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

private synchronized int expelBuffer(long blockFor) throws IOException
{
  if (_buffer==null)
    return 0;
  int result = flushBuffer();
  _buffer.compact();
  if (!_endp.isBlocking())
  {
    while (_buffer.space()==0)
    {
      boolean ready = _endp.blockWritable(blockFor);
      if (!ready)
        throw new IOException("Write timeout");
      result += flushBuffer();
      _buffer.compact();
    }
  }
  return result;
}

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

private synchronized int expelBuffer(long blockFor) throws IOException
{
  if (_buffer==null)
    return 0;
  int result = flushBuffer();
  _buffer.compact();
  if (!_endp.isBlocking())
  {
    while (_buffer.space()==0)
    {
      boolean ready = _endp.blockWritable(blockFor);
      if (!ready)
        throw new IOException("Write timeout");
      result += flushBuffer();
      _buffer.compact();
    }
  }
  return result;
}

相关文章