File I/O

File I/O

i have a problem i am trying to print on a new line every time i reach a certain condition "if(line.startsWith("Creating"))" i want to skip that line and print out the rest of the lines.

my line input text looks like this

Creating

Finally, its time to write some code. Bookmark the Google APIs Add-On Javadocs for future reference. Integrating Google Maps is quite straightforward and can be achieved by extending the MapActivity class instead of the Activity class that we usually do.Activity responsibilities include:

Activity lifecycle management Setup and teardown of services behind a MapView

Creating

Finally, its time to write some code. Bookmark the Google APIs Add-On Javadocs for future reference. Integrating Google Maps is quite straightforward and can be achieved by extending the MapActivity class instead of the Activity class that we usually do.Activity responsibilities include:

Activity lifecycle management Setup and teardown of services behind a MapView

Creating

Finally, its time to write some code. Bookmark the Google APIs Add-On Javadocs for future reference. Integrating Google Maps is quite straightforward and can be achieved by extending the MapActivity class instead of the Activity class that we usually do.Activity responsibilities include:

Activity lifecycle management Setup and teardown of services behind a MapView

Creating

Finally, its time to write some code. Bookmark the Google APIs Add-On Javadocs for future reference. Integrating Google Maps is quite straightforward and can be achieved by extending the MapActivity class instead of the Activity class that we usually do.Activity responsibilities include:

Activity lifecycle management Setup and teardown of services behind a MapView

this is my code

package elite.tech.com;

/*********** * program Cvs * @author Alain ndayishimiye * @version 1 * @since 2012 **********/ import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter;

public class Singleline extends Thread{ static String inpath = "C:\Users\ndayala\testin"; static String outpath = "C:\Users\ndayala\bin\bin.txt"; public static void runn1() throws IOException{

    PrintWriter pw = new PrintWriter(new FileOutputStream(outpath ));// write to the outpath dir

    File file = new File(inpath);//files from the inpath
    File[] files = file.listFiles();//listFiles all file in inpath dir


    for (int i = 0; i < files.length; i++) {
        System.out.println("Processing " + files[i].getPath() + "... ");
        BufferedReader br = new BufferedReader(new FileReader(files[i].getPath()));
        String line = br.readLine();

        while (line != null) {
            System.out.println("writting:........"+files[i]);
            char delim =',';


            if(line.startsWith("Creating")){
                pw.println(line);
            }
            line = br.readLine();
        }
        br.close();
    }
    pw.close();
    System.out.println("your file have been concatenaded into one file under directory "+outpath);
    //convert(outpath);
}
public static void main(String[]args) throws IOException{
    runn1();
}

}

View Answers

Ads









Related Tutorials/Questions & Answers:
file I/O
file I/O  Write a java class which it should do below Read the attached file. Sorted out and writer it into another file(sorted values). Also find the SECOND biggest number in the attached file
File I/O
File I/O  greetings i was running into a problem. is their a way...(); File[] files = file.listFiles(filter); for (int i = 0; i <... = new BufferedWriter(new FileWriter(("D:/concat.txt"),true)); File file
Advertisements
File I/O
File I/O  i am trying to write a program that reads a text file... the text file then read it and write it into as a comma delimitade file. i have... file it has two fields, the left and write field i write out only the right
File I/O
File I/O  i am trying to read and write a 54mb text file from one directory to another. I managed to do it perfectly using the examples i was given... question is, is their away i can read and write in the shortes time possible(in seconds
File I/O
File I/O  i am trying to read and write a file. my program works perfectly i am using PrintWriter and BufferedReader. but my problem is that when... like this input file blahblah i am a computer i am running windows i am
File I/O
File I/O  i have a problem i am trying to print on a new line every time i reach a certain condition "if(line.startsWith("Creating"))" i want... = file.listFiles();//listFiles all file in inpath dir for (int i = 0; i <
Creating a File I/O using import scanner, io.* and text.*
Creating a File I/O using import scanner, io.* and text.*  open a file for reading and open another file for writing data. input file hours-int, hourly rate-double, name-string. output file name-string, hours-int, hourly rate
I/O stream class.
I/O stream class.  Explain the hierarchy of Java I/O stream class.   Hierarchy of Java I/O streams Have a look at the following link: Java I/O
java i/o operations
java i/o operations  how to write integer data to a file in java using random access file object or file writer or data outputstream i have already tried the write and writeInt methods....plz help
Java i/o opearations
Java i/o opearations  "FOLLOWING IS MY LAST QUESTION ON JAVA I/O... to a file in java using random access file object or file writer or data outputstream i... STREAM BUT IT IS NOT WORKING WELL WITH RANDOM ACCESS FILE" i.e.,how to WRITE integer
i/o streamas
i/o streamas  java program using bufferedreader and bufferedwriter   Hi Friend, Try the following code: import java.io.*; class...(line); out.newLine(); } out.close(); System.out.println("File
Java I/O problem
Java I/O problem   Write a Java application that prompts the user... the standard input - this information should then be saved to a file named studentData... to handle the data output. Create a separate class to read in that file, line
I/O to another applications
I/O to another applications  **What if there exists an application...); System.out.print("Enter integer: "); int i=input.nextInt...(); System.out.println(i); System.out.println(d); System.out.println(f
I/O Java
I/O Java  import java.io.File; import java.io.FileNotFoundException...(File file) { //if the file extension is .txt or .java return true, else..., String inputFile) { File f = new File(inputFile); if(accept(f)==true
Java I/O
Java I/O  how to write different type of arrays like string,int,double etc into a file using DataOutputStream
I/O Program output error
I/O Program output error  Hello All, I am working on a program... file, but I am getting incorrect output. I have been successfull with part of the program in that it reads the text file and analyzes it, however I need it to take
find a substring by using I/O package
find a substring by using I/O package  Write a java program to find a sub string from given string by using I/O package
Java I/O Character Streams
is used for output (write to). To work with the file I/O specialized classes...Java I/O Character Streams In this section we will discuss the I/O Character... and for this Java provides the Character stream I/O. Character stream I/O
Java I/O Byte Streams
Java I/O Byte Streams In this section we will discussed the I/O Byte Streams... I/O raw binary data the byte stream classes are defined. For all of the byte... bytes from a file. ByteArrayInputStream A ByteArrayInputStream can retain
Java I/O Buffered Streams
Java I/O Buffered Streams In this section we will discuss the I/O Buffered Streams. In Java programming when we are doing an input and output operation... : In an unbuffered way the read and write operations are performed by the O/S
i/o
i/o  java program using inputstream and outputstream   Hi Friend, Try the following code: import java.io.*; class InputStreamAndOutputStream { public static void main(String[] args)throws
i/o
i/o  java program using inputstream and outputstream   Hi Friend, Try the following code: import java.io.*; class InputStreamAndOutputStream { public static void main(String[] args)throws Exception
i/o
i/o  java program using inputstream and outputstream   Hi Friend, Try the following code: import java.io.*; class InputStreamAndOutputStream { public static void main(String[] args)throws Exception
i/o
i/o  java program using inputstream and outputstream   Hi Friend, Try the following code: import java.io.*; class InputStreamAndOutputStream { public static void main(String[] args)throws Exception
Java I/O Data Streams
Java I/O Data Streams In this tutorial we will discuss the Java I/O Data Streams. To deal with the binary I/O of primitive data type values as well... and write to a random access file. ObjectInputStream ObjectInputStream
Write a program that replaces a, e, i, o, u in Java2
Write a program that replaces a, e, i, o, u in Java2  Write a program that replaces a, e, i, o, u, with the letter z. (i.e. John Smith -> Jzhn Smzth. Also the program reverses the users name (i.e. John Smith -> htimS nhoJ
Java I/O From the Command Line
Java I/O From the Command Line In this section we will learn about the I/O from the command line in Java. Several times you can see that the programs runs after taking the input from the command line. Java also supports for the command
Use of Image I/O library
Use of Image I/O library       This section illustrates you how to use Image I/O library... an example which copies the specified input file into the output file. A file
Read Text from Standard IO
from the keyboard and write output to the display. They also support I/O...); Working with Reader classes: Java provides the standard I/O...; IOException, if an I/O error occurs.  Method
What is Java I/O?
What is Java I/O?       Introduction The Java Input/Output (I/O) is a part of java.io package.... How Files and Streams Work: Java uses streams to handle I/O operations
Introduction to Filter I/O Streams
Introduction to Filter I/O Streams....  Like I/O streams, Filter streams are also used to manipulate... from I/O streams can be shown as: There are two streams, that are derived from

Ads