Esempio n. 1
0
 /**
  * Flushes and closes the specified stream.
  *
  * @param pStream The stream to close.
  */
 public static void FlushCloseStream(Stream pStream)
 {
     if (pStream != null)
     {
         try
         {
             pStream.Flush();
             StreamUtils.CloseStream(pStream);
         }
         catch (IOException e)
         {
             e.PrintStackTrace();
         }
     }
 }
Esempio n. 2
0
 /**
  * Flushes and closes the specified stream.
  *
  * @param pWriter The Writer to close.
  */
 public static void FlushCloseWriter(Stream pWriter)
 {
     if (pWriter != null)
     {
         try
         {
             pWriter.Flush();
             StreamUtils.CloseStream(pWriter);
         }
         catch (IOException e)
         {
             e.PrintStackTrace();
         }
     }
 }
Esempio n. 3
0
 //public static bool copyAndClose(InputStream input, OutputStream output)
 public static bool copyAndClose(System.IO.Stream input, System.IO.Stream output)
 {
     try
     {
         StreamUtils.Copy(input, output, -1);
         return(true);
     }
     catch (IOException e)
     {
         return(false);
     }
     finally
     {
         StreamUtils.CloseStream(input);
         StreamUtils.CloseStream(output);
     }
 }