public class ContentUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
(package private) static int |
DEFAULT_COPY_BUFFER_SIZE |
| Modifier | Constructor and Description |
|---|---|
private |
ContentUtil() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
buffer(java.io.InputStream in) |
static java.lang.String |
buffer(java.io.Reader in) |
static void |
copy(java.io.InputStream in,
java.io.OutputStream out)
Copies the contents of one stream to the other.
|
static void |
copy(java.io.Reader in,
java.io.Writer out)
Copies the contents of one stream to the other.
|
static java.lang.String |
decode(ByteSequence byteSequence)
Decodes the specified sequence of bytes into a string using the US-ASCII
charset.
|
static java.lang.String |
decode(ByteSequence byteSequence,
int offset,
int length)
Decodes a sub-sequence of the specified sequence of bytes into a string
using the US-ASCII charset.
|
private static java.lang.String |
decode(java.nio.charset.Charset charset,
byte[] buffer,
int offset,
int length) |
static java.lang.String |
decode(java.nio.charset.Charset charset,
ByteSequence byteSequence)
Decodes the specified sequence of bytes into a string using the specified
charset.
|
static java.lang.String |
decode(java.nio.charset.Charset charset,
ByteSequence byteSequence,
int offset,
int length)
Decodes a sub-sequence of the specified sequence of bytes into a string
using the specified charset.
|
static ByteSequence |
encode(java.lang.CharSequence string)
Encodes the specified string into an immutable sequence of bytes using
the US-ASCII charset.
|
static ByteSequence |
encode(java.nio.charset.Charset charset,
java.lang.CharSequence string)
Encodes the specified string into an immutable sequence of bytes using
the specified charset.
|
static byte[] |
toAsciiByteArray(java.lang.String s) |
static java.lang.String |
toAsciiString(byte[] b) |
static java.lang.String |
toAsciiString(byte[] b,
int off,
int len) |
static java.lang.String |
toAsciiString(ByteArrayBuffer b) |
static byte[] |
toByteArray(java.lang.String s,
java.nio.charset.Charset charset) |
static java.lang.String |
toString(byte[] b,
java.nio.charset.Charset charset) |
static java.lang.String |
toString(byte[] b,
int off,
int len,
java.nio.charset.Charset charset) |
static java.lang.String |
toString(ByteArrayBuffer b,
java.nio.charset.Charset charset) |
static final int DEFAULT_COPY_BUFFER_SIZE
public static void copy(java.io.InputStream in,
java.io.OutputStream out)
throws java.io.IOException
in - not nullout - not nulljava.io.IOExceptionpublic static void copy(java.io.Reader in,
java.io.Writer out)
throws java.io.IOException
in - not nullout - not nulljava.io.IOExceptionpublic static byte[] buffer(java.io.InputStream in)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String buffer(java.io.Reader in)
throws java.io.IOException
java.io.IOExceptionpublic static ByteSequence encode(java.lang.CharSequence string)
string - string to encode.public static ByteSequence encode(java.nio.charset.Charset charset, java.lang.CharSequence string)
charset - Java charset to be used for the conversion.string - string to encode.public static java.lang.String decode(ByteSequence byteSequence)
byteSequence - sequence of bytes to decode.public static java.lang.String decode(java.nio.charset.Charset charset,
ByteSequence byteSequence)
charset - Java charset to be used for the conversion.byteSequence - sequence of bytes to decode.public static java.lang.String decode(ByteSequence byteSequence, int offset, int length)
byteSequence - sequence of bytes to decode.offset - offset into the byte sequence.length - number of bytes.public static java.lang.String decode(java.nio.charset.Charset charset,
ByteSequence byteSequence,
int offset,
int length)
charset - Java charset to be used for the conversion.byteSequence - sequence of bytes to decode.offset - offset into the byte sequence.length - number of bytes.private static java.lang.String decode(java.nio.charset.Charset charset,
byte[] buffer,
int offset,
int length)
public static byte[] toByteArray(java.lang.String s,
java.nio.charset.Charset charset)
public static byte[] toAsciiByteArray(java.lang.String s)
public static java.lang.String toString(byte[] b,
java.nio.charset.Charset charset)
public static java.lang.String toAsciiString(byte[] b)
public static java.lang.String toString(byte[] b,
int off,
int len,
java.nio.charset.Charset charset)
public static java.lang.String toAsciiString(byte[] b,
int off,
int len)
public static java.lang.String toString(ByteArrayBuffer b, java.nio.charset.Charset charset)
public static java.lang.String toAsciiString(ByteArrayBuffer b)