public class SectionReader
extends java.lang.Object
implements java.io.Closeable
| Constructor and Description |
|---|
SectionReader(java.io.InputStream in) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
forEach(SectionConsumer<? super Section> action)
Convenient interface to iterate all sections, if any excepted with IOException, the iteration will be stopped.
|
Section |
next()
Move to next available section.
|
public Section next() throws java.io.IOException
java.io.IOException - except from input stream, or EOFException if already reaches SECTION_DONEpublic void forEach(SectionConsumer<? super Section> action) throws java.io.IOException, java.lang.IllegalStateException
SectionReader reader = new SectionReader(in);
reader.forEach(x -> processSection(x));
action - the action to accept Section as argument, possibly throws IOExceptionjava.io.IOException - exception in read bytes from input streamjava.lang.IllegalStateException - SectionReader has been iterated with next()public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionCopyright © 2024. All rights reserved.