419350 Do not borrow space from passed arrays
This commit is contained in:
parent
de75b82f99
commit
960c03b8ac
|
@ -300,12 +300,14 @@ public class HttpOutput extends ServletOutputStream
|
|||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Blocking send of content.
|
||||
* @param content The content to send
|
||||
* @param content The content to send.
|
||||
* @throws IOException
|
||||
*/
|
||||
public void sendContent(ByteBuffer content) throws IOException
|
||||
{
|
||||
final BlockingCallback callback =_channel.getWriteBlockingCallback();
|
||||
if (content.hasArray()&&content.limit()<content.capacity())
|
||||
content=content.asReadOnlyBuffer();
|
||||
_channel.write(content,true,callback);
|
||||
callback.block();
|
||||
}
|
||||
|
@ -347,7 +349,6 @@ public class HttpOutput extends ServletOutputStream
|
|||
callback.block();
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Asynchronous send of content.
|
||||
* @param content The content to send
|
||||
|
@ -355,6 +356,8 @@ public class HttpOutput extends ServletOutputStream
|
|||
*/
|
||||
public void sendContent(ByteBuffer content, final Callback callback)
|
||||
{
|
||||
if (content.hasArray()&&content.limit()<content.capacity())
|
||||
content=content.asReadOnlyBuffer();
|
||||
_channel.write(content,true,new Callback()
|
||||
{
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue