本文整理了Java中org.eclipse.jetty.io.Buffer.array()
方法的一些代码示例,展示了Buffer.array()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.array()
方法的具体详情如下:
包路径:org.eclipse.jetty.io.Buffer
类名称:Buffer
方法名:array
[英]Get the underlying array, if one exists.
[中]
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
/**
* @return The {@link Buffer#array()} from the underlying buffer.
*/
public byte[] array()
{
return _buffer.array();
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp
/**
* @return The {@link Buffer#array()} from the underlying buffer.
*/
public byte[] array()
{
return _buffer.array();
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server
/**
* @return The {@link Buffer#array()} from the underlying buffer.
*/
public byte[] array()
{
return _buffer.array();
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus
/**
* @return The {@link Buffer#array()} from the underlying buffer.
*/
public byte[] array()
{
return _buffer.array();
}
代码示例来源: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-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/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-all-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-plus
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 ByteBuffer extractByteBuffer(Buffer buffer)
{
if (buffer.buffer() instanceof NIOBuffer)
return ((NIOBuffer)buffer.buffer()).getByteBuffer();
return ByteBuffer.wrap(buffer.array());
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus
private ByteBuffer extractByteBuffer(Buffer buffer)
{
if (buffer.buffer() instanceof NIOBuffer)
return ((NIOBuffer)buffer.buffer()).getByteBuffer();
return ByteBuffer.wrap(buffer.array());
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp
private ByteBuffer extractByteBuffer(Buffer buffer)
{
if (buffer.buffer() instanceof NIOBuffer)
return ((NIOBuffer)buffer.buffer()).getByteBuffer();
return ByteBuffer.wrap(buffer.array());
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server
private ByteBuffer extractByteBuffer(Buffer buffer)
{
if (buffer.buffer() instanceof NIOBuffer)
return ((NIOBuffer)buffer.buffer()).getByteBuffer();
return ByteBuffer.wrap(buffer.array());
}
代码示例来源: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.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-all-server
byte[] src_array = src.array();
if (src_array != null)
System.arraycopy(src_array, src.getIndex(), _bytes, index, length);
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
public void onFrame(byte flags, byte opcode, Buffer buffer)
{
try
{
byte[] array=buffer.array();
if (opcode==0)
{
if (_websocket instanceof WebSocket.OnTextMessage)
((WebSocket.OnTextMessage)_websocket).onMessage(buffer.toString(StringUtil.__UTF8));
}
else
{
if (_websocket instanceof WebSocket.OnBinaryMessage)
((WebSocket.OnBinaryMessage)_websocket).onMessage(array,buffer.getIndex(),buffer.length());
}
}
catch(Throwable th)
{
LOG.warn(th);
}
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server
public void onFrame(byte flags, byte opcode, Buffer buffer)
{
try
{
byte[] array=buffer.array();
if (opcode==0)
{
if (_websocket instanceof WebSocket.OnTextMessage)
((WebSocket.OnTextMessage)_websocket).onMessage(buffer.toString(StringUtil.__UTF8));
}
else
{
if (_websocket instanceof WebSocket.OnBinaryMessage)
((WebSocket.OnBinaryMessage)_websocket).onMessage(array,buffer.getIndex(),buffer.length());
}
}
catch(Throwable th)
{
LOG.warn(th);
}
}
代码示例来源:origin: org.eclipse.jetty/jetty-websocket
public void onFrame(byte flags, byte opcode, Buffer buffer)
{
try
{
byte[] array=buffer.array();
if (opcode==0)
{
if (_websocket instanceof WebSocket.OnTextMessage)
((WebSocket.OnTextMessage)_websocket).onMessage(buffer.toString(StringUtil.__UTF8));
}
else
{
if (_websocket instanceof WebSocket.OnBinaryMessage)
((WebSocket.OnBinaryMessage)_websocket).onMessage(array,buffer.getIndex(),buffer.length());
}
}
catch(Throwable th)
{
LOG.warn(th);
}
}
内容来源于网络,如有侵权,请联系作者删除!