|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.grizzly.util.Utils
public class Utils
Class contains set of useful operations commonly used in the framework
| Nested Class Summary | |
|---|---|
static class |
Utils.Result
|
| Field Summary | |
|---|---|
static boolean |
VERBOSE_TESTS
|
| Constructor Summary | |
|---|---|
Utils()
|
|
| Method Summary | |
|---|---|
static byte[] |
copy(byte[] src)
|
static void |
dumpErr(java.lang.Object text)
|
static void |
dumpOut(java.lang.Object text)
|
static byte[] |
extractBytes(java.nio.ByteBuffer byteBuffer,
byte startByte,
byte endByte)
Return the bytes contained between the startByte and the endByte. |
static int |
findBytes(java.nio.ByteBuffer byteBuffer,
byte[] b)
Specialized utility method: find a sequence of lower case bytes inside a ByteBuffer. |
static int |
findBytes(java.nio.ByteBuffer bb,
java.util.regex.Pattern pattern)
|
static boolean |
isDebugVM()
|
static java.nio.charset.Charset |
lookupCharset(java.lang.String charsetName)
Deprecated. use Charsets.lookupCharset(java.lang.String) |
static java.nio.channels.Selector |
openSelector()
|
static Utils.Result |
readWithTemporarySelector(java.nio.channels.SelectableChannel channel,
java.nio.ByteBuffer byteBuffer,
long readTimeout)
Method reads data from SelectableChannel to
ByteBuffer. |
static java.util.List<java.lang.String> |
toHexStrings(byte[] bytes)
|
static java.util.List<java.lang.String> |
toHexStrings(byte[] bytes,
int start,
int end)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static boolean VERBOSE_TESTS
| Constructor Detail |
|---|
public Utils()
| Method Detail |
|---|
public static java.nio.charset.Charset lookupCharset(java.lang.String charsetName)
Charsets.lookupCharset(java.lang.String)
Charset by name.
Fixes Charset concurrency issue (http://paul.vox.com/library/post/the-mysteries-of-java-character-set-performance.html)
charsetName -
Charset
public static java.nio.channels.Selector openSelector()
throws java.io.IOException
java.io.IOException
public static Utils.Result readWithTemporarySelector(java.nio.channels.SelectableChannel channel,
java.nio.ByteBuffer byteBuffer,
long readTimeout)
throws java.io.IOException
SelectableChannel to
ByteBuffer. If data is not immediately available - channel
will be reregistered on temporary Selector and wait maximum
readTimeout milliseconds for data.
channel - SelectableChannel to read data frombyteBuffer - ByteBuffer to store read data toreadTimeout - maximum time in millis operation will wait for
incoming data
IOException - if any error was occured during read
java.io.IOException
public static byte[] extractBytes(java.nio.ByteBuffer byteBuffer,
byte startByte,
byte endByte)
byteBuffer - The bytes.startByte - the first byte to look forendByte - the second byte to look for
public static int findBytes(java.nio.ByteBuffer byteBuffer,
byte[] b)
public static int findBytes(java.nio.ByteBuffer bb,
java.util.regex.Pattern pattern)
public static boolean isDebugVM()
public static void dumpOut(java.lang.Object text)
public static void dumpErr(java.lang.Object text)
public static byte[] copy(byte[] src)
public static java.util.List<java.lang.String> toHexStrings(byte[] bytes)
public static java.util.List<java.lang.String> toHexStrings(byte[] bytes,
int start,
int end)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||