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!