Ignore:
Timestamp:
2015-05-22T02:30:34+12:00 (9 years ago)
Author:
davidb
Message:

Changes to make things Java 1.6 friendly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/nz-flag-design/trunk/main-form/my-design.jsp

    r29918 r29919  
    2424
    2525
    26   <%@ page import="java.io.*,java.util.*,java.awt.image.*,javax.imageio.*,javax.xml.bind.DatatypeConverter,java.nio.file.Files,org.json.*" %>
     26  <%@ page import="java.io.*,java.util.*,java.awt.image.*,javax.imageio.*,javax.xml.bind.DatatypeConverter,java.nio.file.*,org.json.*" %>
    2727
    2828  <%!
    29      public static void copyFile( File from, File to ) throws IOException {
     29
     30 
     31private static void copyFile(File source, File dest)
     32        throws IOException {
     33    InputStream input = null;
     34    OutputStream output = null;
     35    try {
     36        input = new FileInputStream(source);
     37        output = new FileOutputStream(dest);
     38        byte[] buf = new byte[1024];
     39        int bytesRead;
     40        while ((bytesRead = input.read(buf)) > 0) {
     41            output.write(buf, 0, bytesRead);
     42        }
     43    } finally {
     44        input.close();
     45        output.close();
     46    }
     47}
     48/*
     49    private static void copyFileChannels(File source, File dest)
     50        throws IOException {
     51      FileChannel inputChannel = null;
     52      FileChannel outputChannel = null;
     53      try {
     54        inputChannel = new FileInputStream(source).getChannel();
     55        outputChannel = new FileOutputStream(dest).getChannel();
     56        outputChannel.transferFrom(inputChannel, 0, inputChannel.size());
     57      } finally {
     58        inputChannel.close();
     59        outputChannel.close();
     60      }
     61    }
     62
     63*/
     64/*
     65     public static void copyFile_JAVA17( File from, File to ) throws IOException {
    3066       Files.copy( from.toPath(), to.toPath() );
    3167     }
     68*/
    3269
    3370     public static void publishFile(File myFlagFile, File pubFlagFile)
Note: See TracChangeset for help on using the changeset viewer.