|
||||||||
| 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 |
copy(java.io.InputStream in,
java.io.OutputStream out,
long length)
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,
long length)
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.Reader |
getBufferedReader(java.io.InputStream in)
Create a buffered reader to read from an input stream using the UTF-8 format. |
static java.io.Writer |
getBufferedWriter(java.io.OutputStream out)
Create a buffered writer to write to an output stream using the UTF-8 format. |
static java.io.InputStream |
getInputStreamFromString(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 |
getReaderFromString(java.lang.String s)
Create a reader to read from a string. |
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. |
static void |
trace(java.lang.String method,
java.lang.String fileName,
java.lang.Object o)
Trace input or output operations if enabled. |
| 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 null
public 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 skipping
public 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 skipping
public 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 (null if writing is not required)
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 (null if writing is not required)
java.io.IOException
public static long copy(java.io.InputStream in,
java.io.OutputStream out,
long length)
throws java.io.IOException
in - the input streamout - the output stream (null if writing is not required)length - the maximum number of bytes to copy
java.io.IOException
public static long copyAndCloseInput(java.io.Reader in,
java.io.Writer out,
long length)
throws java.io.IOException
in - the readerout - the writer (null if writing is not required)length - the maximum number of bytes to copy
java.io.IOExceptionpublic 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 null
public 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.IOExceptionpublic static java.io.Reader getBufferedReader(java.io.InputStream in)
in - the input stream or null
public static java.io.Reader getReader(java.io.InputStream in)
in - the input stream or null
public static java.io.Writer getBufferedWriter(java.io.OutputStream out)
out - the output stream or null
public static java.io.Reader getReaderFromString(java.lang.String s)
s - the string or null
public static java.io.Reader getAsciiReader(java.io.InputStream in)
in - the input stream
public static void trace(java.lang.String method,
java.lang.String fileName,
java.lang.Object o)
method - the method from where this method was calledfileName - the file nameo - the object to append to the messagepublic static java.io.InputStream getInputStreamFromString(java.lang.String s)
s - the string
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||