Package com.networknt.handler
Class BuffersUtils
- java.lang.Object
-
- com.networknt.handler.BuffersUtils
-
public class BuffersUtils extends Object
- Author:
- Andrea Di Cesare <[email protected]>
-
-
Field Summary
Fields Modifier and Type Field Description static RequestInjectionConfigconfigstatic intMAX_CONTENT_SIZE
-
Constructor Summary
Constructors Constructor Description BuffersUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intappend(ByteBuffer src, io.undertow.connector.PooledByteBuffer[] dest, io.undertow.server.HttpServerExchange exchange)append the src data to the pooled buffersstatic voiddump(String msg, io.undertow.connector.PooledByteBuffer[] data)static byte[]getByteArray(io.undertow.connector.PooledByteBuffer[] src)Returns the actual byte array of the PooledByteBufferstatic byte[]toByteArray(io.undertow.connector.PooledByteBuffer[] src)static ByteBuffertoByteBuffer(io.undertow.connector.PooledByteBuffer[] srcs)static StringtoString(byte[] src, Charset cs)static StringtoString(io.undertow.connector.PooledByteBuffer[] srcs, String charsetName)static StringtoString(io.undertow.connector.PooledByteBuffer[] srcs, Charset cs)static inttransfer(io.undertow.connector.PooledByteBuffer[] src, io.undertow.connector.PooledByteBuffer[] dest, io.undertow.server.HttpServerExchange exchange)static inttransfer(ByteBuffer src, io.undertow.connector.PooledByteBuffer[] dest, io.undertow.server.HttpServerExchange exchange)transfer the src data to the pooled buffers overwriting the exising data
-
-
-
Field Detail
-
config
public static final RequestInjectionConfig config
-
MAX_CONTENT_SIZE
public static final int MAX_CONTENT_SIZE
-
-
Method Detail
-
toByteBuffer
public static ByteBuffer toByteBuffer(io.undertow.connector.PooledByteBuffer[] srcs) throws IOException
- Parameters:
srcs- PooledByteBuffer[]- Returns:
- a ByteBuffer containing the content of the srcs
- Throws:
IOException- If the content exceeds the MAX_CONTENT_SIZE
-
toByteArray
public static byte[] toByteArray(io.undertow.connector.PooledByteBuffer[] src) throws IOException- Throws:
IOException
-
getByteArray
public static byte[] getByteArray(io.undertow.connector.PooledByteBuffer[] src) throws IOExceptionReturns the actual byte array of the PooledByteBuffer- Parameters:
src-- Returns:
- Throws:
IOException
-
toString
public static String toString(io.undertow.connector.PooledByteBuffer[] srcs, Charset cs) throws IOException
- Throws:
IOException
-
toString
public static String toString(io.undertow.connector.PooledByteBuffer[] srcs, String charsetName) throws IOException
- Throws:
IOException
-
toString
public static String toString(byte[] src, Charset cs) throws IOException
- Throws:
IOException
-
transfer
public static int transfer(ByteBuffer src, io.undertow.connector.PooledByteBuffer[] dest, io.undertow.server.HttpServerExchange exchange)
transfer the src data to the pooled buffers overwriting the exising data- Parameters:
src- ByteBufferdest- PooledByteBuffer[]exchange- HttpServerExchange- Returns:
- int
-
dump
public static void dump(String msg, io.undertow.connector.PooledByteBuffer[] data)
-
append
public static int append(ByteBuffer src, io.undertow.connector.PooledByteBuffer[] dest, io.undertow.server.HttpServerExchange exchange)
append the src data to the pooled buffers- Parameters:
src- ByteBufferdest- PooledByteBuffer[]exchange- HttpServerExchange- Returns:
- int
-
transfer
public static int transfer(io.undertow.connector.PooledByteBuffer[] src, io.undertow.connector.PooledByteBuffer[] dest, io.undertow.server.HttpServerExchange exchange)
-
-