Package cern.accsoft.steering.jmad.util
Class StreamUtil
- java.lang.Object
-
- cern.accsoft.steering.jmad.util.StreamUtil
-
public final class StreamUtil extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
copy(java.io.InputStream inputStream, java.io.OutputStream outputStream)
copies all data from the input stream to the output stream.static boolean
toFile(java.io.InputStream inputStream, java.io.File destinationFile)
ensures, that the given input stream is extracted to the given file.
-
-
-
Method Detail
-
copy
public static void copy(java.io.InputStream inputStream, java.io.OutputStream outputStream) throws java.io.IOException
copies all data from the input stream to the output stream. The output stream is flushed afterwards. None of the streams is opened or closed.- Parameters:
inputStream
- the stream from which to copy the dataoutputStream
- the stream to copy the data to- Throws:
java.io.IOException
- if something goes wrong.
-
toFile
public static final boolean toFile(java.io.InputStream inputStream, java.io.File destinationFile)
ensures, that the given input stream is extracted to the given file. If the file already exists it is overwritten!- Parameters:
inputStream
- the stream from which to readdestinationFile
- the file where the resource shall be extracted to- Returns:
- true if successful, false if not
-
-