public class GbinObjectReader
extends java.lang.Object
gaia.cu1.tools.dal.gbin.GbinReader
interface.
This object can read the elements stored in a GBIN file.
Access is via reflection, so I don't need GaiaTools on the classpath at build time, for several reasons:
Constructor and Description |
---|
GbinObjectReader(java.lang.Object gbinReaderObj)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
createGbinReaderObject(java.io.InputStream in)
Constructs a GbinReader from a given input stream.
|
static GbinObjectReader |
createReader(java.io.InputStream in)
Attempts to construct a GbinObjectReader that can read records
from a given input stream.
|
boolean |
hasNext()
Indicates whether this reader can read another element.
|
static void |
initGaiaTools()
Performs GaiaTools setup required before GbinReaders are used etc.
|
static boolean |
isMagic(byte[] intro)
Indicates whether a buffer containing the first few bytes of a
file look like a GBIN magic number.
|
java.lang.Object |
next()
Reads the next record.
|
public GbinObjectReader(java.lang.Object gbinReaderObj)
gbinReaderObj
- object implementing
gaia.cu1.tools.dal.gbin.GbinReader
java.lang.IllegalArgumentException
- if gbinReaderObj
doesn't appear to be a GbinReaderpublic boolean hasNext() throws java.io.IOException
next
java.io.IOException
public java.lang.Object next() throws java.io.IOException
gaia.cu1.tools.dm.GaiaRoot
java.io.IOException
public static GbinObjectReader createReader(java.io.InputStream in) throws java.io.IOException
in
- input stream containing a GBIN filejava.io.IOException
public static boolean isMagic(byte[] intro)
Note this has not been exhaustively tested with all known GBIN variants.
intro
- first few bytes to testpublic static void initGaiaTools()
createReader
.
Calls after the first one do nothing, but are harmless and cheap.
Uses reflection.public static java.lang.Object createGbinReaderObject(java.io.InputStream in) throws java.io.IOException
gaia.cu1.tools.dal.gbin.GbinFactory.getGbinReader()
.in
- input stream assumed to contain a GBIN filegaia.cu1.tools.dal.gbin.GbinReader
interfacejava.io.IOException
- with informative message if something goes wrong,
including reflection trouble