public final class Buffers extends Object
| Modifier and Type | Field and Description |
|---|---|
static Buffer |
EMPTY_BUFFER
An empty buffer.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
assertNotEmpty(Buffer buffer) |
static void |
assertNotEmpty(Buffer buffer,
String msg) |
static Buffer |
createBuffer(int capacity)
Create a new Buffer
|
static void |
getBytes(int i,
int index,
byte[] buf)
Copied straight from the Integer class but modified to return bytes instead.
|
static void |
getBytes(long i,
int index,
byte[] buf)
Copied straight from the Long class but modified to return bytes instead.
|
static int |
stringSize(int x) |
static int |
stringSize(long x) |
static int |
stringSizeOf(int value)
Find out how many characters it would take to represent the value as a string.
|
static int |
stringSizeOf(long value)
Find out how many characters it would take to represent the value as a string.
|
static Buffer |
wrap(Buffer one,
Buffer two)
Combine two buffers into one.
|
static Buffer |
wrap(byte[] buffer)
Wrap the supplied byte array
|
static Buffer |
wrap(byte[] buffer,
int lowerBoundary,
int upperBoundary)
Wrap the supplied byte array specifying the allowed range of visible
bytes.
|
static Buffer |
wrap(InputStream is) |
static Buffer |
wrap(int value)
Converts the integer value into a string and that is what is being
wrapped in a
Buffer |
static Buffer |
wrap(long value) |
static Buffer |
wrap(String s) |
static Buffer |
wrapAndClone(byte[] buffer)
Same as
wrap(byte[]) but we will clone the byte array first. |
public static Buffer EMPTY_BUFFER
public static Buffer wrap(int value)
Buffervalue - public static Buffer wrap(long value)
public static Buffer wrap(InputStream is)
public static Buffer createBuffer(int capacity)
capacity - public static Buffer wrap(byte[] buffer)
buffer - public static Buffer wrapAndClone(byte[] buffer)
wrap(byte[]) but we will clone the byte array first.buffer - public static Buffer wrap(Buffer one, Buffer two)
one - two - public static Buffer wrap(byte[] buffer, int lowerBoundary, int upperBoundary)
buffer - lowerBoundary - the index of the lowest byte that is accessible to this Buffer
(zero based index)upperBoundary - the upper boundary (exclusive) of the range of visible bytes.public static void assertNotEmpty(Buffer buffer)
public static void getBytes(int i,
int index,
byte[] buf)
public static int stringSizeOf(int value)
value - public static int stringSize(int x)
public static void getBytes(long i,
int index,
byte[] buf)
public static int stringSizeOf(long value)
value - public static int stringSize(long x)
Copyright © 2021. All Rights Reserved.