public class Mutils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
NEWLINE
The new-line character for the current platform, e.g.
|
Modifier and Type | Method and Description |
---|---|
static void |
copy(InputStream from,
OutputStream to,
int bufferSize)
Copies an input stream to another stream
|
static boolean |
hasValue(String val) |
static boolean |
nullOrEmpty(String val) |
static byte[] |
toByteArray(InputStream source,
int bufferSize)
Reads the given input stream into a byte array and closes the input stream
|
static String |
urlDecode(String value) |
static String |
urlEncode(String value) |
public static final String NEWLINE
\n
in Linux or \r\n
on Windows.public static String urlEncode(String value)
value
- the value to encodepublic static String urlDecode(String value)
value
- the value to decodepublic static void copy(InputStream from, OutputStream to, int bufferSize) throws IOException
from
- The source of the bytesto
- The destination of the bytesbufferSize
- The size of the byte buffer to use as bytes are copiedIOException
- Thrown if there is a problem reading from or writing to either streampublic static byte[] toByteArray(InputStream source, int bufferSize) throws IOException
source
- The source of the bytesbufferSize
- The size of the byte buffer to use when copying streamsIOException
- If there is an error reading from the streampublic static boolean nullOrEmpty(String val)
public static boolean hasValue(String val)
Copyright © 2017–2018. All rights reserved.