Package jade.imtp.leap.nio
Class NIOHelper
- java.lang.Object
-
- jade.imtp.leap.nio.NIOHelper
-
public class NIOHelper extends Object
static helper for ssl/nio related handshaking/input/output- Author:
- eduard
-
-
Field Summary
Fields Modifier and Type Field Description static ByteBufferEMPTY_BUFFER
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intcopyAsMuchAsFits(ByteBuffer dst, ByteBuffer src)copy data from src to dst, as much as fits in dst.static ByteBufferenlargeAndFillBuffer(ByteBuffer b, int extraSpace, String name)returns an enlarged, filled with bytes from the buffer argumentstatic ByteBufferenlargeBuffer(ByteBuffer b, int extraSpace, String name)callsenlargeBuffer(java.nio.ByteBuffer, int, java.lang.String, boolean)with false for doLogstatic ByteBufferenlargeBuffer(ByteBuffer b, int extraSpace, String name, boolean doLog)returns an enlarged, empty bufferstatic voidlogBuffer(ByteBuffer b)logs info on a bytebuffer at level FINE with name "unknown"static voidlogBuffer(ByteBuffer b, String name)logs info on a bytebuffer at level FINE with name <name>static voidlogBuffer(ByteBuffer b, String name, Level l)logs info on a bytebuffer at level <l> with name <name>
-
-
-
Field Detail
-
EMPTY_BUFFER
public static final ByteBuffer EMPTY_BUFFER
-
-
Method Detail
-
logBuffer
public static void logBuffer(ByteBuffer b)
logs info on a bytebuffer at level FINE with name "unknown"- Parameters:
b-
-
logBuffer
public static void logBuffer(ByteBuffer b, String name)
logs info on a bytebuffer at level FINE with name <name>- Parameters:
b-
-
logBuffer
public static void logBuffer(ByteBuffer b, String name, Level l)
logs info on a bytebuffer at level <l> with name <name>- Parameters:
b-
-
copyAsMuchAsFits
public static int copyAsMuchAsFits(ByteBuffer dst, ByteBuffer src)
copy data from src to dst, as much as fits in dst. src's position() will be moved when data are copied.- Parameters:
src- copy fromdst- copy to- Returns:
- number of bytes copied
-
enlargeBuffer
public static ByteBuffer enlargeBuffer(ByteBuffer b, int extraSpace, String name)
callsenlargeBuffer(java.nio.ByteBuffer, int, java.lang.String, boolean)with false for doLog- Parameters:
b-extraSpace-name- the name of the buffer- Returns:
- the new enlarged buffer
-
enlargeBuffer
public static ByteBuffer enlargeBuffer(ByteBuffer b, int extraSpace, String name, boolean doLog)
returns an enlarged, empty buffer- Parameters:
b-extraSpace-name- the name of the bufferdoLog- log the changes or not- Returns:
- the new enlarged buffer
-
enlargeAndFillBuffer
public static ByteBuffer enlargeAndFillBuffer(ByteBuffer b, int extraSpace, String name)
returns an enlarged, filled with bytes from the buffer argument- Parameters:
b-extraSpace-- Returns:
- the new enlarged buffer
-
-