org.jfree.io
Class IOUtils
The IOUtils provide some IO related helper methods.
void | copyStreams(InputStream in, OutputStream out) - Copies the InputStream into the OutputStream, until the end of the stream
has been reached.
|
void | copyStreams(InputStream in, OutputStream out, int buffersize) - Copies the InputStream into the OutputStream, until the end of the stream
has been reached.
|
void | copyWriter(Reader in, Writer out) - Copies the contents of the Reader into the Writer, until the end of the
stream has been reached.
|
void | copyWriter(Reader in, Writer out, int buffersize) - Copies the contents of the Reader into the Writer, until the end of the
stream has been reached.
|
String | createRelativeURL(URL url, URL baseURL) - Creates a relative url by stripping the common parts of the the url.
|
String | getFileExtension(String file) - Returns the file extension of the given file name.
|
String | getFileName(URL url) - Extracts the file name from the URL.
|
static IOUtils | getInstance() - Gets the singleton instance of the utility package.
|
boolean | isSubDirectory(File base, File child) - Checks, whether the child directory is a subdirectory of the base
directory.
|
String | stripFileExtension(String file) - Removes the file extension from the given file name.
|
copyStreams
public void copyStreams(InputStream in,
OutputStream out)
throws IOException
Copies the InputStream into the OutputStream, until the end of the stream
has been reached. This method uses a buffer of 4096 kbyte.
in
- the inputstream from which to read.out
- the outputstream where the data is written to.
copyStreams
public void copyStreams(InputStream in,
OutputStream out,
int buffersize)
throws IOException
Copies the InputStream into the OutputStream, until the end of the stream
has been reached.
in
- the inputstream from which to read.out
- the outputstream where the data is written to.buffersize
- the buffer size.
copyWriter
public void copyWriter(Reader in,
Writer out)
throws IOException
Copies the contents of the Reader into the Writer, until the end of the
stream has been reached. This method uses a buffer of 4096 kbyte.
in
- the reader from which to read.out
- the writer where the data is written to.
copyWriter
public void copyWriter(Reader in,
Writer out,
int buffersize)
throws IOException
Copies the contents of the Reader into the Writer, until the end of the
stream has been reached.
in
- the reader from which to read.out
- the writer where the data is written to.buffersize
- the buffer size.
createRelativeURL
public String createRelativeURL(URL url,
URL baseURL)
Creates a relative url by stripping the common parts of the the url.
url
- the to be stripped urlbaseURL
- the base url, to which the url
is relative
to.
- the relative url, or the url unchanged, if there is no relation
beween both URLs.
getFileExtension
public String getFileExtension(String file)
Returns the file extension of the given file name.
The returned value will contain the dot.
getFileName
public String getFileName(URL url)
Extracts the file name from the URL.
getInstance
public static IOUtils getInstance()
Gets the singleton instance of the utility package.
isSubDirectory
public boolean isSubDirectory(File base,
File child)
throws IOException
Checks, whether the child directory is a subdirectory of the base
directory.
base
- the base directory.child
- the suspected child directory.
- true, if the child is a subdirectory of the base directory.
stripFileExtension
public String stripFileExtension(String file)
Removes the file extension from the given file name.
- the file name without the file extension.