public class Utils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Utils.DummyPrintStream |
static class |
Utils.SimpleBuffer |
static interface |
Utils.ThreadFactory |
static class |
Utils.ThreadPool |
Modifier and Type | Field and Description |
---|---|
protected static char[] |
BASE64ARRAY |
static int |
COPY_BUF_SIZE |
protected static byte[] |
DECODABET
Translates a Base64 value to either its 6-bit reconstruction value or a negative number indicating some other meaning.
|
static Class[] |
EMPTY_CLASSES |
static Enumeration |
EMPTY_ENUMERATION |
static Object[] |
EMPTY_OBJECTS |
protected static byte |
EQUALS_SIGN
The equals sign (=) as a byte.
|
protected static byte |
EQUALS_SIGN_ENC |
static String |
ISO_8859_1 |
protected static byte |
WHITE_SPACE_ENC |
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static String |
base64Decode(String _s,
String _enc)
base 64 decoding
|
static String |
base64Encode(byte[] _bytes)
base 64 encoding, array of bytes converted to bytes using specified encoding
|
static String |
base64Encode(String _s,
String _enc)
base 64 encoding, string converted to bytes using specified encoding
|
static String |
calculateClassPath(ClassLoader cl)
calculate local file based class path for class loader if possible (servlet classes must be located there)
|
static String |
canonicalizePath(String path) |
static String[] |
copyOf(String[] original,
int newLength) |
static String[] |
copyOfRange(String[] original,
int from,
int newLength) |
static void |
copyStream(InputStream in,
OutputStream out,
long maxLen) |
static void |
copyStream(Reader in,
OutputStream out,
String charSet) |
static void |
copyStream(Reader in,
Writer out) |
static byte[] |
decode(byte[] source,
int off,
int len)
Very low-level access to decoding ASCII characters in the form of a byte array.
|
static String |
decode(String s,
String enc)
Decodes URL encoded string including newly introduced JavaScript encoding with %uxxxx chars
|
static byte[] |
decode64(String s)
Decodes data from Base64 notation, automatically detecting gzip-compressed data and decompressing it.
|
static String |
htmlEncode(String s,
boolean encodeWS) |
static float |
isGzipAccepted(String contentEncoding) |
static String |
lsDateStr(Date date) |
static void |
main(String[] args) |
static boolean |
match(String pattern,
String string) |
static int |
matchSpan(String pattern,
String string) |
static Map |
parsePostData(long len,
InputStream is,
String encoding,
String[] cachedStream) |
static Hashtable |
parseQueryString(String query,
String encoding) |
static String[] |
splitStr(String str) |
static String[] |
splitStr(String str,
char delim) |
static String[] |
splitStr(String str,
String quotes) |
static String |
toFile(URL url) |
public static final int COPY_BUF_SIZE
public static final String ISO_8859_1
public static final Class[] EMPTY_CLASSES
public static final Object[] EMPTY_OBJECTS
public static final Enumeration EMPTY_ENUMERATION
protected static final char[] BASE64ARRAY
protected static final byte[] DECODABET
protected static final byte WHITE_SPACE_ENC
protected static final byte EQUALS_SIGN_ENC
protected static final byte EQUALS_SIGN
public static Map parsePostData(long len, InputStream is, String encoding, String[] cachedStream) throws IOException
IOException
public static String decode(String s, String enc) throws UnsupportedEncodingException
s
- encoded stringenc
- source encodingUnsupportedEncodingException
public static float isGzipAccepted(String contentEncoding)
public static void copyStream(InputStream in, OutputStream out, long maxLen) throws IOException
IOException
public static void copyStream(Reader in, Writer out) throws IOException
IOException
public static void copyStream(Reader in, OutputStream out, String charSet) throws IOException
IOException
public static final String base64Encode(String _s, String _enc)
String
- String
- encoding, can be null, then iso-8859-1 usedno
- exceptionspublic static final String base64Encode(byte[] _bytes)
String
- String
- encoding, can be null, then iso-8859-1 usedNullPointerException
- if input parameter is nullpublic static final String base64Decode(String _s, String _enc)
encoded
- stringencoding
- used to get string bytespublic static byte[] decode(byte[] source, int off, int len)
source
- The Base64 encoded dataoff
- The offset of where to begin decodinglen
- The length of characters to decodepublic static byte[] decode64(String s)
s
- the string to decodepublic static String calculateClassPath(ClassLoader cl)
cl
- class loaderpublic static void main(String[] args)
Copyright © 2014. All Rights Reserved.