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

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

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

Buffer.length介绍

[英]The number of bytes from the getIndex to the putIndex
[中]从getIndex到putIndex的字节数

代码示例

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

private int flushMask()
{
  return  ((_header != null && _header.length() > 0)?4:0)
  | ((_buffer != null && _buffer.length() > 0)?2:0)
  | ((_bypass && _content != null && _content.length() > 0)?1:0);
}

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

public boolean isEmpty()
{
  return (_header==null||_header.length()==0) &&
  (_buffer==null||_buffer.length()==0) &&
  (_content==null||_content.length()==0);
}

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

public boolean isEmpty()
{
  return (_header==null||_header.length()==0) &&
  (_buffer==null||_buffer.length()==0) &&
  (_content==null||_content.length()==0);
}

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

public boolean isEmpty()
{
  return (_header==null||_header.length()==0) &&
  (_buffer==null||_buffer.length()==0) &&
  (_content==null||_content.length()==0);
}

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

public boolean isBufferEmpty()
{
  _lock.lock();
  try
  {
    return _buffer == null || _buffer.length() == 0;
  }
  finally
  {
    _lock.unlock();
  }
}

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

public boolean isBufferEmpty()
{
  _lock.lock();
  try
  {
    return _buffer == null || _buffer.length() == 0;
  }
  finally
  {
    _lock.unlock();
  }
}

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

public boolean isBufferEmpty()
{
  _lock.lock();
  try
  {
    return _buffer == null || _buffer.length() == 0;
  }
  finally
  {
    _lock.unlock();
  }
}

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

public int fill(Buffer buffer) throws IOException
{
  int size=buffer.length();
  process(buffer, null);
  int filled=buffer.length()-size;
  if (filled==0 && isInputShutdown())
    return -1;
  return filled;
}

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

public int fill(Buffer buffer) throws IOException
{
  int size=buffer.length();
  process(buffer, null);
  int filled=buffer.length()-size;
  if (filled==0 && isInputShutdown())
    return -1;
  return filled;
}

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

@Override // TODO simone says shouldn't be needed
  public void content(Buffer ref) throws IOException
  {
    if (_error == null)
      _error = "Bad response. " + ref.length() + "B of content?";
    _endp.close();
  }
});

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

public void parsedRemoteAddr(Buffer addr) throws IOException
{
  if (addr != null && addr.length()>0)
  {
    _request.setRemoteAddr(addr.toString());
  }
}

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

@Override // TODO simone says shouldn't be needed
  public void content(Buffer ref) throws IOException
  {
    if (_error == null)
      _error = "Bad response. " + ref.length() + "B of content?";
    _endp.close();
  }
});

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

public void returnBuffer()
{
  if (_buffer!=null && _buffer.length()==0)
  {
    _buffers.returnBuffer(_buffer);
    _buffer=null;
  }
}

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

@Override
protected void onResponseContent(Buffer content) throws IOException
{
  if (debug != 0)
    _log.debug(debug + " content" + content.length());
  content.writeTo(out);
}

代码示例来源: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 void fill(Buffer buffer)
{
  if (buffer!=null && buffer.length()>0)
  {
    if (_buffer==null)
      _buffer=_buffers.getBuffer();
    _buffer.put(buffer);
    buffer.clear();
  }
}

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

public void fill(Buffer buffer)
{
  if (buffer!=null && buffer.length()>0)
  {
    if (_buffer==null)
      _buffer=_buffers.getBuffer();
    _buffer.put(buffer);
    buffer.clear();
  }
}

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

public InputStream getInputStream() throws IOException
{
  Buffer indirect = getIndirectBuffer();
  if (indirect!=null && indirect.array()!=null)
    return new ByteArrayInputStream(indirect.array(),indirect.getIndex(),indirect.length());
    return _resource.getInputStream();
}

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

public InputStream getInputStream() throws IOException
{
  Buffer indirect = getIndirectBuffer();
  if (indirect!=null && indirect.array()!=null)
    return new ByteArrayInputStream(indirect.array(),indirect.getIndex(),indirect.length());
    return _resource.getInputStream();
}

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

private void addBuffer(Buffer b)
{
  if (b == null)
  {
    addInt(0xFFFF);
    return;
  }
  addInt(b.length());
  _buffer.put(b);
  _buffer.put((byte)0);
}

相关文章