Results 1 to 2 of 2

Thread: write sequence data java program

  1. #1
    Brownchris is offline Senior Member
    Join Date
    Dec 2009
    Posts
    331
    Rep Power
    3

    Default write sequence data java program

    How to write sequence data to file using java program?

  2. #2
    Millerjames is offline Senior Member
    Join Date
    Dec 2009
    Posts
    331
    Rep Power
    3

    Default

    This small example uses two file streams to copy the contents of one file into another:

    import java.io.*;

    class FileStreamsTest {
    public static void main(String[] args) {
    try {
    File inputFile = new File("farrago.txt");
    File outputFile = new File("outagain.txt");

    FileInputStream fis = new FileInputStream(inputFile);
    FileOutputStream fos = new FileOutputStream(outputFile);
    int c;

    while ((c = fis.read()) != -1) {
    fos.write(c);
    }

    fis.close();
    fos.close();
    } catch (FileNotFoundException e) {
    System.err.println("FileStreamsTest: " + e);
    } catch (IOException e) {
    System.err.println("FileStreamsTest: " + e);
    }
    }
    }

Similar Threads

  1. Replies: 2
    Last Post: 05-14-2010, 01:30 PM
  2. Replies: 1
    Last Post: 05-03-2010, 01:37 PM
  3. Write program in LAN Voice Chat
    By MorganCooper in forum Programming
    Replies: 1
    Last Post: 04-03-2010, 01:16 PM
  4. How to write a element Listener in Java?
    By Brownchris in forum Software Jargons
    Replies: 1
    Last Post: 02-13-2010, 01:56 PM
  5. Write program on palindrome in java
    By MoralesMyers in forum Programming
    Replies: 2
    Last Post: 01-14-2010, 06:24 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48