Package org.cy3sbml.util
Class IOUtil
java.lang.Object
org.cy3sbml.util.IOUtil
Helper functions for input and output.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic InputStreamReads the stream into memory and closes it, e.g. to read a stream twice.static FilecreateUniqueFile(File directory, String fileName, String extension) A file in the directory with the name and extension that does not exist yet: the name with a suffix_0,_1, ... if the file exists.static InputStreamreadResource(String resource) The classpath resource of the app.static InputStreamThe UTF-8 bytes of the string as stream.
-
Constructor Details
-
IOUtil
public IOUtil()
-
-
Method Details
-
readResource
The classpath resource of the app.- Parameters:
resource- the absolute resource path- Returns:
- the stream, null if there is no such resource
-
string2InputStream
The UTF-8 bytes of the string as stream.- Parameters:
s- the string- Returns:
- the stream
-
copyInputStream
Reads the stream into memory and closes it, e.g. to read a stream twice.- Parameters:
is- the stream, closed afterwards- Returns:
- a stream of the bytes read
- Throws:
IOException- if the stream cannot be read
-
createUniqueFile
A file in the directory with the name and extension that does not exist yet: the name with a suffix_0,_1, ... if the file exists.- Parameters:
directory- the directoryfileName- the file name without extensionextension- the file extension, with the dot- Returns:
- the file, not created
-