|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.util.IOUtils
public class IOUtils
This utility class contains input/output functions.
Method Summary | |
---|---|
static void |
closeSilently(java.io.InputStream in)
Close an input stream without throwing an exception. |
static void |
closeSilently(java.io.OutputStream out)
Close an output stream without throwing an exception. |
static void |
closeSilently(java.io.Reader reader)
Close a reader without throwing an exception. |
static void |
closeSilently(java.io.Writer writer)
Close a writer without throwing an exception. |
static long |
copy(java.io.InputStream in,
java.io.OutputStream out)
Copy all data from the input stream to the output stream. |
static long |
copyAndClose(java.io.InputStream in,
java.io.OutputStream out)
Copy all data from the input stream to the output stream and close both streams. |
static long |
copyAndCloseInput(java.io.InputStream in,
java.io.OutputStream out)
Copy all data from the input stream to the output stream and close the input stream. |
static long |
copyAndCloseInput(java.io.Reader in,
java.io.Writer out)
Copy all data from the reader to the writer and close the reader. |
static java.io.Reader |
getAsciiReader(java.io.InputStream in)
Wrap an input stream in a reader. |
static java.io.InputStream |
getInputStream(java.lang.String s)
Create an input stream to read from a string. |
static java.io.Reader |
getReader(java.io.InputStream in)
Create a reader to read from an input stream using the UTF-8 format. |
static java.io.Reader |
getReader(java.lang.String s)
Create a reader to read from a string. |
static java.io.Writer |
getWriter(java.io.OutputStream out)
Create a buffered writer to write to an output stream using the UTF-8 format. |
static byte[] |
readBytesAndClose(java.io.InputStream in,
int length)
Read a number of bytes from an input stream and close the stream. |
static int |
readFully(java.io.InputStream in,
byte[] buffer,
int off,
int max)
Try to read the given number of bytes to the buffer. |
static int |
readFully(java.io.Reader in,
char[] buffer,
int max)
Try to read the given number of characters to the buffer. |
static java.lang.String |
readStringAndClose(java.io.Reader in,
int length)
Read a number of characters from a reader and close it. |
static void |
skipFully(java.io.InputStream in,
long skip)
Skip a number of bytes in an input stream. |
static void |
skipFully(java.io.Reader reader,
long skip)
Skip a number of characters in a reader. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void closeSilently(java.io.OutputStream out)
out
- the output stream or nullpublic static void skipFully(java.io.InputStream in, long skip) throws java.io.IOException
in
- the input streamskip
- the number of bytes to skip
java.io.EOFException
- if the end of file has been reached before all bytes
could be skipped
java.io.IOException
- if an IO exception occurred while skippingpublic static void skipFully(java.io.Reader reader, long skip) throws java.io.IOException
reader
- the readerskip
- the number of characters to skip
java.io.EOFException
- if the end of file has been reached before all
characters could be skipped
java.io.IOException
- if an IO exception occurred while skippingpublic static long copyAndClose(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
in
- the input streamout
- the output stream
java.io.IOException
public static long copyAndCloseInput(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
in
- the input streamout
- the output stream
java.io.IOException
public static long copy(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
in
- the input streamout
- the output stream
java.io.IOException
public static long copyAndCloseInput(java.io.Reader in, java.io.Writer out) throws java.io.IOException
in
- the readerout
- the writer
java.io.IOException
public static void closeSilently(java.io.InputStream in)
in
- the input stream or nullpublic static void closeSilently(java.io.Reader reader)
reader
- the reader or nullpublic static void closeSilently(java.io.Writer writer)
writer
- the writer or nullpublic static byte[] readBytesAndClose(java.io.InputStream in, int length) throws java.io.IOException
in
- the input streamlength
- the maximum number of bytes to read, or -1 to read until
the end of file
java.io.IOException
public static java.lang.String readStringAndClose(java.io.Reader in, int length) throws java.io.IOException
in
- the readerlength
- the maximum number of characters to read, or -1 to read
until the end of file
java.io.IOException
public static int readFully(java.io.InputStream in, byte[] buffer, int off, int max) throws java.io.IOException
in
- the input streambuffer
- the output bufferoff
- the offset in the buffermax
- the number of bytes to read at most
java.io.IOException
public static int readFully(java.io.Reader in, char[] buffer, int max) throws java.io.IOException
in
- the readerbuffer
- the output buffermax
- the number of characters to read at most
java.io.IOException
public static java.io.Reader getReader(java.io.InputStream in)
in
- the input stream or null
public static java.io.Writer getWriter(java.io.OutputStream out)
out
- the output stream or null
public static java.io.InputStream getInputStream(java.lang.String s)
s
- the string
public static java.io.Reader getReader(java.lang.String s)
s
- the string or null
public static java.io.Reader getAsciiReader(java.io.InputStream in)
in
- the input stream
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |