- package com.dev.concurrent;
- import java.io.FileInputStream;
- import java.io.FileOutputStream;
- import java.io.IOException;
- /**
- * File to File Copy using Java Streams.
- *
- */
- public class StreamExample
- {
- public void byteStreamExample() {
- try(FileInputStream in = new FileInputStream("samplein.txt")) {
- try (FileOutputStream out = new FileOutputStream("sampleout.txt")) {
- int c;
- while ((c = in.read()) != -1) {
- out.write(c);
- }
- }catch (IOException e) {
- e.printStackTrace();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- public static void main(String[] args)
- {
- StreamExample se = new StreamExample() ;
- se.byteStreamExample() ;
- }
- }
{{theTime}}
Search This Blog
Total Pageviews
File to File Copy Using Java Streams
Subscribe to:
Post Comments (Atom)
java.lang.NoSuchFieldError: Class com.sun.tools.javac.tree.JCTree$JCImport
SpringBoot Error: java.lang.NoSuchFieldError: Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.j...
No comments:
Post a Comment