Class CopyFile


  • public class CopyFile
    extends java.lang.Object
    Handles backup generation for files.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.io.File copy​(java.io.File source)
      Copies the given source file to a temporary file.
      static java.io.File copy​(java.io.File source, java.io.File target)
      Copies the given source file to the given destination.
      static void copyStreams​(java.io.InputStream source, java.io.OutputStream target)
      Reads everything from source and writes it to target and attempts to close them after reading.
      static void copyStreams​(java.io.InputStream source, java.io.OutputStream target, boolean closeStreams)
      Reads everything from source and writes it to target.
      static java.io.File createCrTempFile()
      Identical to CopyFile.createTempFile("magellan", ".tmp.cr").
      static java.io.File createTempFile()
      Identical to createTempFile("magellan", null).
      static java.io.File createTempFile​(java.lang.String prefix)
      Identical to createTempFile(prefix, null).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • copy

        public static java.io.File copy​(java.io.File source)
                                 throws java.io.IOException
        Copies the given source file to a temporary file.
        Parameters:
        source - source file.
        Returns:
        The temporary file.
        Throws:
        java.io.IOException - if an I/O error occurs
      • copy

        public static java.io.File copy​(java.io.File source,
                                        java.io.File target)
                                 throws java.io.IOException
        Copies the given source file to the given destination.
        Parameters:
        source - source file.
        target - destination target file.
        Returns:
        target
        Throws:
        java.io.IOException - if an I/O error occurs
      • createCrTempFile

        public static java.io.File createCrTempFile()
                                             throws java.io.IOException
        Identical to CopyFile.createTempFile("magellan", ".tmp.cr").
        Returns:
        The temp file
        Throws:
        java.io.IOException - if an I/O error occurs
      • createTempFile

        public static java.io.File createTempFile()
                                           throws java.io.IOException
        Identical to createTempFile("magellan", null).
        Returns:
        The temp file
        Throws:
        java.io.IOException - if an I/O error occurs
      • createTempFile

        public static java.io.File createTempFile​(java.lang.String prefix)
                                           throws java.io.IOException
        Identical to createTempFile(prefix, null).
        Returns:
        The temp file
        Throws:
        java.io.IOException - if an I/O error occurs
      • copyStreams

        public static void copyStreams​(java.io.InputStream source,
                                       java.io.OutputStream target)
                                throws java.io.IOException
        Reads everything from source and writes it to target and attempts to close them after reading.
        Parameters:
        source -
        target -
        Throws:
        java.io.IOException - if an I/O error occurs
      • copyStreams

        public static void copyStreams​(java.io.InputStream source,
                                       java.io.OutputStream target,
                                       boolean closeStreams)
                                throws java.io.IOException
        Reads everything from source and writes it to target.
        Parameters:
        source -
        target -
        closeStreams - if true, will attempt to close the streams after reading
        Throws:
        java.io.IOException - if an I/O error occurs