Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
11 | - | 1 | package org.geoscope.JSpec; |
2 | |||
3 | import java.io.FileInputStream; |
||
4 | import java.io.FileOutputStream; |
||
5 | import java.io.IOException; |
||
6 | import java.nio.channels.FileChannel; |
||
7 | |||
8 | public class Utils { |
||
9 | |||
10 | public static void copy_file(String initial_path, String initial_name, String to_path, String to_name) throws IOException{ |
||
11 | FileChannel inChannel = new |
||
12 | FileInputStream((initial_path+'/'+initial_name)).getChannel(); |
||
13 | |||
14 | FileChannel outChannel = new |
||
15 | FileOutputStream( (to_path+'/'+to_name)).getChannel(); |
||
16 | try { |
||
17 | inChannel.transferTo(0, inChannel.size(),outChannel); |
||
18 | } |
||
19 | |||
20 | finally { |
||
21 | if (inChannel != null) inChannel.close(); |
||
22 | if (outChannel != null) outChannel.close(); |
||
23 | } |
||
24 | } |
||
25 | |||
26 | |||
27 | public static String padZeroLeft(String input, int final_size) |
||
28 | { |
||
29 | String output=input; |
||
30 | while (output.length()< final_size) { |
||
31 | output="0"+output; |
||
32 | } |
||
33 | |||
34 | return output; |
||
35 | } |
||
36 | public static void main(String[] args) throws IOException { |
||
37 | |||
38 | |||
39 | } |
||
40 | |||
41 | } |