final class Util
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.nio.charset.Charset |
UTF_8
A cheap and type-safe constant for the UTF-8 Charset.
|
| Modifier | Constructor and Description |
|---|---|
private |
Util() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
arrayRangeEquals(byte[] a,
int aOffset,
byte[] b,
int bOffset,
int byteCount) |
static void |
checkOffsetAndCount(long size,
long offset,
long byteCount) |
static int |
reverseBytesInt(int i) |
static long |
reverseBytesLong(long v) |
static short |
reverseBytesShort(short s) |
static void |
sneakyRethrow(java.lang.Throwable t)
Throws
t, even if the declared throws clause doesn't permit it. |
private static <T extends java.lang.Throwable> |
sneakyThrow2(java.lang.Throwable t) |
public static final java.nio.charset.Charset UTF_8
public static void checkOffsetAndCount(long size,
long offset,
long byteCount)
public static short reverseBytesShort(short s)
public static int reverseBytesInt(int i)
public static long reverseBytesLong(long v)
public static void sneakyRethrow(java.lang.Throwable t)
t, even if the declared throws clause doesn't permit it.
This is a terrible – but terribly convenient – hack that makes it easy to
catch and rethrow exceptions after cleanup. See Java Puzzlers #43.private static <T extends java.lang.Throwable> void sneakyThrow2(java.lang.Throwable t)
throws T extends java.lang.Throwable
T extends java.lang.Throwablepublic static boolean arrayRangeEquals(byte[] a,
int aOffset,
byte[] b,
int bOffset,
int byteCount)