public class DxfGroupReader extends AbstractIterableInput<DxfGroup>
DxfGroupIterableInput.Status| Constructor and Description |
|---|
DxfGroupReader(VfsFile file) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
closeImp()
Subclass implementation of guts of close() method.
|
protected boolean |
fetchImp()
Subclass implementation of guts of fetch() method.
|
int |
getCurrentLineNumber()
Returns the line number the current group starts on.
|
DxfGroup |
getFetched()
Returns the last fetched item (if immutable) or a copy of it (if
mutable).
|
protected void |
openImp()
Subclass implementation of guts of open() method.
|
java.util.List<DxfGroup> |
readAll()
Reads all remaining groups in the file.
|
java.util.List<DxfGroup> |
readAll(java.util.List<DxfGroup> results)
Reads all remaining groups in the file and appends them to the provided
list.
|
DxfGroup |
readGroup()
Reads a single DxfGroup from the input.
|
java.util.List<DxfGroup> |
readGroups(int count)
Reads up to the listed number of DXFGroups from the input.
|
java.util.List<DxfGroup> |
readGroups(int count,
java.util.List<DxfGroup> results)
Reads up to the listed number of DXFGroups from the input, appending them
to the given results list.
|
java.util.List<DxfGroup> |
readUntilCode(java.util.List<DxfGroup> results,
int code)
Reads groups until it sees one that with the given code.
|
java.util.List<DxfGroup> |
readUntilMatch(java.util.List<DxfGroup> results,
int code,
java.lang.String value)
Reads groups until it sees one that matches the given code and value.
|
boolean |
scanForGroup(DxfGroup group)
Scans the file for the given group pattern, discarding intervening
groups.
|
boolean |
scanForGroups(DxfGroup group1,
DxfGroup group2)
Scans the file for the given pair of groups, discarding intervening
groups.
|
boolean |
scanForGroups(int code,
java.lang.String value) |
java.lang.String |
toString() |
close, fetch, getException, getStatus, isFetchValid, iterator, openpublic DxfGroupReader(VfsFile file) throws java.io.IOException
java.io.IOExceptionprotected void openImp()
throws java.lang.Exception
AbstractIterableInputSubclasses must implement this to do the actual work required by open(). Feel free to throw exceptions; these are caught inside the open() itself and applied to the exception variable. Thus, you can focus on the actual task instead of paperwork.
openImp in class AbstractIterableInput<DxfGroup>java.lang.Exceptionprotected boolean fetchImp()
throws java.lang.Exception
AbstractIterableInputSubclasses must implement this to do the actual work required by fetch(). Feel free to throw exceptions; these are caught inside the fetch() itself and applied to the exception variable. Thus, you can focus on the actual task instead of paperwork.
fetchImp in class AbstractIterableInput<DxfGroup>java.lang.Exceptionprotected void closeImp()
throws java.lang.Exception
AbstractIterableInputSubclasses must implement this to do the actual work required by close(). Feel free to throw exceptions; these are caught inside the close() itself and applied to the exception variable. Thus, you can focus on the actual task instead of paperwork.
closeImp in class AbstractIterableInput<DxfGroup>java.lang.Exceptionpublic DxfGroup getFetched()
IterableInputThe last fetched item is that loaded by the most recent call to fetch().
Implementations may prefer to instantiate this lazily; in other words, the underlying IterableInput may know that it has a valid fetch (e.g. loaded the characters for a String into an internal buffer) but may not have created this object yet (e.g. created a new String with the characters from the buffer). This allows skipping items without instantiating them, or accessing the underlying state without instantiating an actual item.
Implementations may also wish to provide unsafe access to the fetched item via other methods or public variables. The requirement that a safe copy be returned does prevent object reuse or other optimizations with this method, so feel free to use other means to provide a high-performance alternative.
This method may only be called when the input is in the FETCHING status. Calling it from any other status will result in an IllegalStateException.
public DxfGroup readGroup() throws java.io.IOException
java.io.IOException - if unable to read the inputjava.io.EOFException - if EOF occurs in middle of group readpublic java.util.List<DxfGroup> readGroups(int count) throws java.io.IOException
count - number of groups to attempt readjava.io.IOException - if unable to read the inputjava.io.EOFException - if EOF occurs in the middle of a group readpublic java.util.List<DxfGroup> readGroups(int count, java.util.List<DxfGroup> results) throws java.io.IOException
count - number of groups to attempt readresults - list to append read groups tojava.io.IOException - if unable to read the inputjava.io.EOFException - if EOF occurs in the middle of a group readpublic java.util.List<DxfGroup> readUntilMatch(java.util.List<DxfGroup> results, int code, java.lang.String value) throws java.io.IOException
readGroup() or look at it via getFetched().results - code - value - java.io.IOExceptionpublic java.util.List<DxfGroup> readUntilCode(java.util.List<DxfGroup> results, int code) throws java.io.IOException
readGroup() or look at it
via getFetched().results - code - java.io.IOExceptionpublic java.util.List<DxfGroup> readAll() throws java.io.IOException
java.io.IOException - if it can't read them for some reasonpublic java.util.List<DxfGroup> readAll(java.util.List<DxfGroup> results) throws java.io.IOException
readAll()). Beware of doing this to large files!results - list to append groups tojava.io.IOException - if it can't read them for some reasonpublic int getCurrentLineNumber()
public boolean scanForGroup(DxfGroup group)
public boolean scanForGroups(int code,
java.lang.String value)
public boolean scanForGroups(DxfGroup group1, DxfGroup group2)
public java.lang.String toString()
toString in class java.lang.Object