Package org.arakhne.afc.gis.io.binary
Class GISLayerReader
- java.lang.Object
-
- org.arakhne.afc.gis.io.binary.GISLayerReader
-
- All Implemented Interfaces:
AutoCloseable
,Iterable<MapLayer>
public class GISLayerReader extends Object implements AutoCloseable, Iterable<MapLayer>
Reader of GIS elements in a Java serialized form.- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:54
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.gis
- Maven Artifact Id:
- gisinputoutput
-
-
Constructor Summary
Constructors Constructor Description GISLayerReader(File filename)
Constructs a GIS reader.GISLayerReader(InputStream stream)
Constructs a GIS reader.GISLayerReader(URL url)
Constructs a GIS reader.GISLayerReader(ReadableByteChannel channel)
Constructs a GIS writer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Flush temp buffers, and close the streams.Progression
getProgression()
Replies the task progression.Iterator<MapLayer>
iterator()
<T extends MapLayer>
Iterator<T>iterator(Class<T> type)
Replies an iterator on the layers of the given type and read from the input stream.MapLayer
read()
Read the next layer from the input.<T extends MapLayer>
Tread(Class<T> type)
Read the next layer of the given type from the input.protected void
readHeader()
Read the header of the file.void
setProgression(Progression progressBar)
Set the task progression associated to this reader.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
GISLayerReader
public GISLayerReader(File filename) throws IOException
Constructs a GIS reader.- Parameters:
filename
- is the file to read- Throws:
IOException
- in case of error.
-
GISLayerReader
public GISLayerReader(URL url) throws IOException
Constructs a GIS reader.- Parameters:
url
- is the URL of the file to read- Throws:
IOException
- in case of error.
-
GISLayerReader
public GISLayerReader(ReadableByteChannel channel) throws IOException
Constructs a GIS writer.- Parameters:
channel
- is the file to write- Throws:
IOException
- in case of error.
-
GISLayerReader
public GISLayerReader(InputStream stream) throws IOException
Constructs a GIS reader.- Parameters:
stream
- is is the stream to read- Throws:
IOException
- in case of error.
-
-
Method Detail
-
getProgression
@Pure public Progression getProgression()
Replies the task progression.- Returns:
- the task progression object associated to this reader, or
null
-
setProgression
public void setProgression(Progression progressBar)
Set the task progression associated to this reader.- Parameters:
progressBar
- is the task progression object associated to this reader, ornull
-
close
public void close() throws IOException
Flush temp buffers, and close the streams.- Specified by:
close
in interfaceAutoCloseable
- Throws:
IOException
- in case of error.
-
iterator
public <T extends MapLayer> Iterator<T> iterator(Class<T> type)
Replies an iterator on the layers of the given type and read from the input stream.- Type Parameters:
T
- the type of the layers to reply.- Parameters:
type
- is the type of the layers to reply.- Returns:
- the iterator.
-
read
public final MapLayer read() throws IOException
Read the next layer from the input.- Returns:
- the next layer in the input stream.
- Throws:
IOException
- in case of error.IndexOutOfBoundsException
- in case of error.
-
read
public final <T extends MapLayer> T read(Class<T> type) throws IOException
Read the next layer of the given type from the input.- Type Parameters:
T
- is the type of the expected layer.- Parameters:
type
- is the type of the expected layer.- Returns:
- the next layer in the input stream, or
null
if there is no more object of the given type. - Throws:
IOException
- in case of error.IndexOutOfBoundsException
- in case of error.
-
readHeader
protected void readHeader() throws IOException
Read the header of the file.- Throws:
IOException
- in case of error.
-
-