JPad
Snippets
Download
Help
Contact
fileio
How to copy a file in java 8. Using JPad as a scripting language.
Code
final File file = new File("c:\\temp\\jwrit\\outt.csv"); Object o = new int[] {1,2,3}; JPad.writeCsv(o, file); java.nio.file.Files.copy(file.toPath(), Paths.get("c:\\temp\\jwrit\\copy.csv"));
Result
Console
Bytecode
Compiled from "RunnContainer.java" public class io.jpad.scratch.RunnContainer { public io.jpad.scratch.RunnContainer(); Code: 0: aload_0 1: invokespecial #1 // Method java/lang/Object."<init>":()V 4: return public static void main(java.lang.String...) throws java.lang.Exception; Code: 0: new #2 // class java/io/File 3: dup 4: ldc #3 // String c:\temp\jwrit\outt.csv 6: invokespecial #4 // Method java/io/File."<init>":(Ljava/lang/String;)V 9: astore_1 10: iconst_3 11: newarray int 13: dup 14: iconst_0 15: iconst_1 16: iastore 17: dup 18: iconst_1 19: iconst_2 20: iastore 21: dup 22: iconst_2 23: iconst_3 24: iastore 25: astore_2 26: aload_2 27: aload_1 28: invokestatic #5 // Method io/jpad/scratch/JPad.writeCsv:(Ljava/lang/Object;Ljava/io/File;)V 31: aload_1 32: invokevirtual #6 // Method java/io/File.toPath:()Ljava/nio/file/Path; 35: ldc #7 // String c:\temp\jwrit\copy.csv 37: iconst_0 38: anewarray #8 // class java/lang/String 41: invokestatic #9 // Method java/nio/file/Paths.get:(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path; 44: iconst_0 45: anewarray #10 // class java/nio/file/CopyOption 48: invokestatic #11 // Method java/nio/file/Files.copy:(Ljava/nio/file/Path;Ljava/nio/file/Path;[Ljava/nio/file/CopyOption;)Ljava/nio/file/Path; 51: pop 52: return }
Jpad Version:1.07
viewCount:4221
Creator:
admin
Latest Editor:
admin
Tags
file
io
Download
Copy As Markdown:
**code [fileio.java](/example/1I/fileio)** final File file = new File("c:\\temp\\jwrit\\outt.csv"); Object o = new int[] {1,2,3}; JPad.writeCsv(o, file); java.nio.file.Files.copy(file.toPath(), Paths.get("c:\\temp\\jwrit\\copy.csv")); **Result:**