|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.gbin.GbinObjectReader
public class GbinObjectReader
Provides read services for an object implementing the
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 Summary | |
---|---|
GbinObjectReader(Object gbinReaderObj)
Constructor. |
Method Summary | |
---|---|
static Object |
createGbinReaderObject(InputStream in)
Constructs a GbinReader from a given input stream. |
static GbinObjectReader |
createReader(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. |
Object |
next()
Reads the next record. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GbinObjectReader(Object gbinReaderObj)
gbinReaderObj
- object implementing
gaia.cu1.tools.dal.gbin.GbinReader
IllegalArgumentException
- if gbinReaderObj
doesn't appear to be a GbinReaderMethod Detail |
---|
public boolean hasNext() throws IOException
next
IOException
public Object next() throws IOException
gaia.cu1.tools.dm.GaiaRoot
IOException
public static GbinObjectReader createReader(InputStream in) throws IOException
in
- input stream containing a GBIN file
IOException
public static boolean isMagic(byte[] intro)
Note this has not been exhaustively tested with all known GBIN variants.
intro
- first few bytes to test
public static void initGaiaTools()
createReader
.
Calls after the first one do nothing, but are harmless and cheap.
Uses reflection.
public static Object createGbinReaderObject(InputStream in) throws IOException
gaia.cu1.tools.dal.gbin.GbinFactory.getGbinReader()
.
in
- input stream assumed to contain a GBIN file
gaia.cu1.tools.dal.gbin.GbinReader
interface
IOException
- with informative message if something goes wrong,
including reflection trouble
|
Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |