|
-
File I/O Please help!
Hi i need help with a simple I/O problem. I have a large text file, which i want to break up into smaller files. I want to break the file each time "From -" is found at the start of a new line.
public static void main(String[] args) throws Exception {
String path1 = "file1";
BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(path1)));
BufferedWriter out = new BufferedWriter(new FileWriter("Emails//out.txt"));
String line;
while((line = br.readLine()) != null)
{
if(line.startsWith("From -")){
//send from here to the next "from -" into a text file
}
}
}
}
Above is as far as ive come, i dont know how to send each block of text to an individual file, can anybody help, it would be greatly appreciated!
Thanks
Similar Threads
-
By Arjuna in forum Database
Replies: 2
Last Post: 07-25-2007, 03:22 AM
-
By Shaitan00 in forum Java
Replies: 1
Last Post: 04-06-2005, 06:04 AM
-
Replies: 0
Last Post: 04-29-2003, 01:10 AM
-
By Brian Patrick in forum VB Classic
Replies: 0
Last Post: 02-25-2001, 02:12 PM
-
By wannabe in forum VB Classic
Replies: 0
Last Post: 02-15-2001, 03:35 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks