public class ContentUtil extends Object
Modifier and Type | Method and Description |
---|---|
static byte[] |
buffer(InputStream in) |
static String |
buffer(Reader in) |
static void |
copy(InputStream in,
OutputStream out)
Copies the contents of one stream to the other.
|
static void |
copy(Reader in,
Writer out)
Copies the contents of one stream to the other.
|
static String |
decode(ByteSequence byteSequence)
Decodes the specified sequence of bytes into a string using the US-ASCII
charset.
|
static 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.
|
static String |
decode(Charset charset,
ByteSequence byteSequence)
Decodes the specified sequence of bytes into a string using the specified
charset.
|
static String |
decode(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(CharSequence string)
Encodes the specified string into an immutable sequence of bytes using
the US-ASCII charset.
|
static ByteSequence |
encode(Charset charset,
CharSequence string)
Encodes the specified string into an immutable sequence of bytes using
the specified charset.
|
static byte[] |
toAsciiByteArray(String s) |
static String |
toAsciiString(byte[] b) |
static String |
toAsciiString(byte[] b,
int off,
int len) |
static String |
toAsciiString(ByteArrayBuffer b) |
static byte[] |
toByteArray(String s,
Charset charset) |
static String |
toString(byte[] b,
Charset charset) |
static String |
toString(byte[] b,
int off,
int len,
Charset charset) |
static String |
toString(ByteArrayBuffer b,
Charset charset) |
public static void copy(InputStream in, OutputStream out) throws IOException
in
- not nullout
- not nullIOException
public static void copy(Reader in, Writer out) throws IOException
in
- not nullout
- not nullIOException
public static byte[] buffer(InputStream in) throws IOException
IOException
public static String buffer(Reader in) throws IOException
IOException
public static ByteSequence encode(CharSequence string)
string
- string to encode.public static ByteSequence encode(Charset charset, CharSequence string)
charset
- Java charset to be used for the conversion.string
- string to encode.public static String decode(ByteSequence byteSequence)
byteSequence
- sequence of bytes to decode.public static String decode(Charset charset, ByteSequence byteSequence)
charset
- Java charset to be used for the conversion.byteSequence
- sequence of bytes to decode.public static 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 String decode(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.public static byte[] toAsciiByteArray(String s)
public static String toAsciiString(byte[] b)
public static String toAsciiString(byte[] b, int off, int len)
public static String toString(ByteArrayBuffer b, Charset charset)
public static String toAsciiString(ByteArrayBuffer b)
Copyright © 2004–2023 The Apache Software Foundation. All rights reserved.