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