Interface NativeJavaResourceOut
-
- All Superinterfaces:
NativeJavaResource
- All Known Subinterfaces:
NativeJavaResourceInOut
public interface NativeJavaResourceOut extends NativeJavaResource
Supports writing to a resource (out).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description OutputStream
getOutputStream()
Opens a stream to write data to.OutputStream
getOutputStream(WriteMode writeMode)
Similar togetOutputStream()
except that it allows you to specify the WriteMode.OutputStream
getOutputStream(WriteMode writeMode, String fileExtension)
Similar togetOutputStream(String)
except that it allows you to specify the WriteMode.OutputStream
getOutputStream(String fileExtension)
Opens a stream to write data to.
-
-
-
Method Detail
-
getOutputStream
OutputStream getOutputStream() throws IOException
Opens a stream to write data to. For parameters this writes to the "Out" value of a parameter and will be become a distinct JobFile afterwards. The caller is responsible for closing this stream. The file by default will be called 'parametername.dat' for parameters of type File, and 'parametername.rtx' for parameters of type Table. If you want to use a different file extension usegetOutputStream(String)
instead. Additionally if you want to append, instead of overwriting the file (which is the default behavior when called multiple times), you can usegetOutputStream(WriteMode)
or both options combined usegetOutputStream(WriteMode, String)
.- Returns:
- OutputStream to write to.
- Throws:
IOException
- When the stream cannot be opened
-
getOutputStream
OutputStream getOutputStream(WriteMode writeMode) throws IOException
Similar togetOutputStream()
except that it allows you to specify the WriteMode. Note that the first time this method is called a file does not exist yet, but if called multiple times the WriteMode.Append will append to that file rather that overwriting it.- Parameters:
writeMode
- Whether to overwrite an existing file or append to it instead.- Returns:
- OutputStream to write to.
- Throws:
IOException
- When the stream cannot be opened
-
getOutputStream
OutputStream getOutputStream(String fileExtension) throws IOException
Opens a stream to write data to. For parameters this writes to the "Out" value of a parameter and will be become a distinct JobFile afterwards. The caller is responsible for closing this stream. The name of the file will be parametername + fileExtension. For example with a parameter called 'data' and file extension '.txt' the file will be written as 'data.txt'. Using this method multiple times will always write to 1 file and overwrite it, even when different extensions are used - the last extension is used in that case.- Parameters:
fileExtension
- File extension to use, e.g. .txt- Returns:
- OutputStream to write to.
- Throws:
IOException
- When the stream cannot be opened
-
getOutputStream
OutputStream getOutputStream(WriteMode writeMode, String fileExtension) throws IOException
Similar togetOutputStream(String)
except that it allows you to specify the WriteMode.- Parameters:
writeMode
- Whether to overwrite an existing file or append to it instead.fileExtension
- File extension to use, e.g. .txt- Returns:
- OutputStream to write to.
- Throws:
IOException
- When the stream cannot be opened
-
-