public abstract class HTTPUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
HTTPUtil.InterceptRequest |
static class |
HTTPUtil.InterceptResponse |
| Modifier and Type | Field and Description |
|---|---|
static Charset |
ASCII |
static String |
DRIVELETTERS |
static String |
LOWERCASE |
static String |
UPPERCASE |
static Charset |
UTF8 |
| Constructor and Description |
|---|
HTTPUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
abspath(String path)
Convert path to add a leading '/'; assumes canonical.
|
static String |
canonicalpath(String path)
Convert path to use '/' consistently and
to remove any trailing '/'
|
static void |
canonicalpath(StringBuilder s) |
static String |
canonjoin(String prefix,
String suffix)
Join two string together to form proper path
WITHOUT trailing slash
|
static File |
fillTempFile(String base,
String content) |
static boolean |
hasDriveLetter(String path) |
protected static boolean |
hasDriveLetter(StringBuilder path) |
static boolean |
isAbsolutePath(String path) |
protected static Map<ucar.httpservices.HTTPSession.Prop,Object> |
merge(Map<ucar.httpservices.HTTPSession.Prop,Object> globalsettings,
Map<ucar.httpservices.HTTPSession.Prop,Object> localsettings) |
static String |
nullify(String s)
Convert a zero-length string to null
|
static URI |
parseToURI(String u)
Convert a uri string to an instance of java.net.URI.
|
static byte[] |
readbinaryfile(File f) |
static byte[] |
readbinaryfile(InputStream stream) |
static String |
readtextfile(InputStream stream) |
static String |
readtextfile(Reader rdr) |
static String |
relpath(String path)
Convert path to remove any leading '/' or drive letter assumes canonical.
|
static void |
writebinaryfile(byte[] content,
File dst) |
public static final Charset UTF8
public static final Charset ASCII
public static final String LOWERCASE
public static final String UPPERCASE
public static final String DRIVELETTERS
public static byte[] readbinaryfile(File f) throws IOException
IOExceptionpublic static byte[] readbinaryfile(InputStream stream) throws IOException
IOExceptionpublic static File fillTempFile(String base, String content) throws IOException
IOExceptionpublic static URI parseToURI(String u) throws URISyntaxException
u - the uri to convertURISyntaxExceptionprotected static Map<ucar.httpservices.HTTPSession.Prop,Object> merge(Map<ucar.httpservices.HTTPSession.Prop,Object> globalsettings, Map<ucar.httpservices.HTTPSession.Prop,Object> localsettings)
public static String nullify(String s)
s - the string to check for lengthpublic static String canonjoin(String prefix, String suffix)
prefix - suffix - public static String canonicalpath(String path)
path - convert this pathpublic static void canonicalpath(StringBuilder s)
public static String relpath(String path)
path - convert this pathpublic static boolean hasDriveLetter(String path)
path - to testprotected static boolean hasDriveLetter(StringBuilder path)
public static boolean isAbsolutePath(String path)
path - to testpublic static String abspath(String path)
path - convert this pathpublic static String readtextfile(InputStream stream) throws IOException
IOExceptionpublic static String readtextfile(Reader rdr) throws IOException
IOExceptionpublic static void writebinaryfile(byte[] content,
File dst)
throws IOException
IOException