org.pentaho.reporting.libraries.base.util
public class IOUtils extends Object
Method Summary | |
---|---|
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 | createRelativePath(String targetFile, String baseFile)
Creates a relative url by stripping the common parts of the the url.
|
String | createRelativeURL(URL url, URL baseURL)
Creates a relative url by stripping the common parts of the the url.
|
File | findFileOnClassPath(String name)
Returns a reference to a file with the specified name that is located somewhere on the classpath. |
String | getAbsolutePath(String targetFile, String baseFile)
Computes the absolute filename for the target file using the baseFile as root directory. |
String | getFileExtension(String file)
Returns the file extension of the given file name. |
String | getFileName(URL url)
Extracts the file name from the URL.
|
String | getFileName(String path)
Extracts the last file name from the given pathname.
|
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.
|
void | readFully(InputStream in, byte[] data, int offset, int length)
Reads the given number of bytes into the target array. |
String | stripFileExtension(String file)
Removes the file extension from the given file name.
|
Parameters: in the inputstream from which to read. out the outputstream where the data is written to.
Throws: java.io.IOException if a IOError occurs.
Parameters: in the inputstream from which to read. out the outputstream where the data is written to. buffersize the buffer size.
Throws: java.io.IOException if a IOError occurs.
Parameters: in the reader from which to read. out the writer where the data is written to.
Throws: java.io.IOException if a IOError occurs.
Parameters: in the reader from which to read. out the writer where the data is written to. buffersize the buffer size.
Throws: java.io.IOException if a IOError occurs.
Parameters: targetFile the to be stripped url baseFile the base url, to which the url
is relative to.
Returns: the relative url, or the url unchanged, if there is no relation beween both URLs.
Parameters: url the to be stripped url baseURL the base url, to which the url
is relative to.
Returns: the relative url, or the url unchanged, if there is no relation beween both URLs.
Parameters: name the filename.
Returns: a reference to a file or null
if no file could be found.
Parameters: targetFile the target file name. baseFile the base file (can be null).
Returns: the absolute path.
Parameters: file the file name.
Returns: the file extension.
Parameters: url the url.
Returns: the extracted filename.
Parameters: path the path name.
Returns: the extracted filename.
Returns: the singleton instance.
Parameters: base the base directory. child the suspected child directory.
Returns: true, if the child is a subdirectory of the base directory.
Throws: java.io.IOException if an IOError occured during the test.
Parameters: in the inputstream from where to read. data the array where to store the data. offset the offset in the array where to store the data. length the number of bytes to be read.
Throws: IOException if an IO error occured or the End of the stream has been reached.
Parameters: file the file name.
Returns: the file name without the file extension.