- 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)
Generate Insert Sql from Select Statement
SELECT 'INSERT INTO ReferenceTable (ID, Name) VALUES (' + CAST(ID AS NVARCHAR) + ', ''' + Name + ''...
No comments:
Post a Comment