|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.pentaho.reporting.libraries.base.util.IOUtils
public class IOUtils
The IOUtils provide some IO related helper methods.
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(String path)
Extracts the last file name from the given pathname. |
String |
getFileName(URL url)
Extracts the file name from the URL. |
static IOUtils |
getInstance()
Gets the singleton instance of the utility package. |
String |
getPath(String path)
Returns the path-portion of the given path (anything before the last slash or backslash) or an empty string. |
boolean |
isSubDirectory(File base,
File child)
Checks, whether the child directory is a subdirectory of the base directory. |
byte[] |
readBlob(Blob clob)
Converts a SQL-Clob object into a String. |
String |
readClob(Clob clob)
Converts a SQL-Clob object into a String. |
void |
readFully(InputStream in,
byte[] data,
int offset,
int length)
Reads the given number of bytes into the target array. |
int |
readSafely(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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static IOUtils getInstance()
public String createRelativePath(String targetFile, String baseFile)
targetFile
- the to be stripped urlbaseFile
- the base url, to which the url
is relative to.
public String createRelativeURL(URL url, URL baseURL)
url
- the to be stripped urlbaseURL
- the base url, to which the url
is relative to.
public void copyStreams(InputStream in, OutputStream out) throws IOException
in
- the inputstream from which to read.out
- the outputstream where the data is written to.
IOException
- if a IOError occurs.public void copyStreams(InputStream in, OutputStream out, int buffersize) throws IOException
in
- the inputstream from which to read.out
- the outputstream where the data is written to.buffersize
- the buffer size.
IOException
- if a IOError occurs.public void copyWriter(Reader in, Writer out) throws IOException
in
- the reader from which to read.out
- the writer where the data is written to.
IOException
- if a IOError occurs.public void copyWriter(Reader in, Writer out, int buffersize) throws IOException
in
- the reader from which to read.out
- the writer where the data is written to.buffersize
- the buffer size.
IOException
- if a IOError occurs.public void readFully(InputStream in, byte[] data, int offset, int length) throws IOException
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.
IOException
- if an IO error occured or the End of the stream has been reached.public int readSafely(InputStream in, byte[] data, int offset, int length) throws IOException
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.
IOException
- if an IO error occured or the End of the stream has been reached.public String getFileName(URL url)
url
- the url.
public String getFileName(String path)
path
- the path name.
public String stripFileExtension(String file)
file
- the file name.
public String getFileExtension(String file)
file
- the file name.
public boolean isSubDirectory(File base, File child) throws IOException
base
- the base directory.child
- the suspected child directory.
IOException
- if an IOError occured during the test.public File findFileOnClassPath(String name) throws SecurityException
name
- the filename.
null
if no file could be found.
SecurityException
- if access to the system properties or filesystem is forbidden.public String getAbsolutePath(String targetFile, String baseFile)
targetFile
- the target file name.baseFile
- the base file (can be null).
public String getPath(String path)
path
- the path or filename from where to extract the path name.
public String readClob(Clob clob)
clob
- the clob to be read as string.
public byte[] readBlob(Blob clob) throws SQLException
clob
- the clob to be read as string.
SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |