public class Loader
extends java.lang.Object
| Constructor and Description |
|---|
Loader() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
loadBytes(java.io.InputStream ios,
int size)
Creates a byte array of the specifed size and loads it from the given InputStream.
|
static byte[] |
loadBytes(java.net.URL url)
A shortcut to loadBytes(InputStream, int) that uses URLConnection.getInputStream() to get the stream,
and URLConnection.getContentLength() to get the size of the byte array.
|
static byte[] |
loadBytes(java.net.URL url,
int size)
A shortcut to loadBytes(InputStream, int) that uses URL.openStream() to get the InputStream.
|
static java.lang.String |
loadString(java.io.InputStream ios)
Invokes loadString() with approxlen parameter of 512.
|
static java.lang.String |
loadString(java.io.InputStream ios,
int approxlen)
Loads a String from an input stream.
|
static void |
main(java.lang.String[] args) |
public static java.lang.String loadString(java.io.InputStream ios)
throws java.lang.Exception
java.lang.Exceptionpublic static java.lang.String loadString(java.io.InputStream ios,
int approxlen)
throws java.lang.Exception
approxlen - The size of the byte buffer to use when loading.java.lang.Exceptionpublic static byte[] loadBytes(java.io.InputStream ios,
int size)
throws java.lang.Exception
java.lang.Exceptionpublic static byte[] loadBytes(java.net.URL url,
int size)
throws java.lang.Exception
java.lang.Exceptionpublic static byte[] loadBytes(java.net.URL url)
throws java.lang.Exception
java.lang.RuntimeException - if URLConnection.getContentLength() returns 0, which happens with some
poorly supported URL types, depending on platform.java.lang.Exceptionpublic static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception