// Open an InputStream to read from the file File file = new File("hl7_messages.txt"); InputStream is = new FileInputStream(file); // It's generally a good idea to buffer file IO is = new BufferedInputStream(is); // The following class is a HAPI utility that will iterate over // the messages which appear over an InputStream Hl7InputStreamMessageIterator iter = new Hl7InputStreamMessageIterator(is); while (iter.hasNext()) { Message next = iter.next(); // Do something with the message }
Message next = iter.next();