uk.me.parabola.imgfmt.app
Interface ImgFileReader

All Superinterfaces:
java.io.Closeable
All Known Implementing Classes:
BufferedImgFileReader

public interface ImgFileReader
extends java.io.Closeable

For reading subfiles from the img. The focus of mkgmap is on writing, but some limited reading is needed for several operations.

Author:
Steve Ratcliffe

Method Summary
 byte get()
          Read in a single byte.
 byte[] get(int len)
          Read in an arbitrary length sequence of bytes.
 int get3()
          Get a 3byte signed quantity.
 java.lang.String getBase11str(byte firstChar, char delimiter)
          Read in a string of digits in the compressed base 11 format that is used for phone numbers in the POI section.
 char getChar()
          Read in two bytes.
 int getInt()
          Read in a 4 byte value.
 int getu3()
          Get a 3byte unsigned quantity.
 java.lang.String getZString()
          Read a zero terminated string from the file.
 long position()
          Get the position.
 void position(long pos)
          Set the position of the file.
 
Methods inherited from interface java.io.Closeable
close
 

Method Detail

position

long position()
Get the position. Needed because may not be reflected in the underlying file if being buffered.

Returns:
The logical position within the file.

position

void position(long pos)
Set the position of the file.

Parameters:
pos - The new position in the file.

get

byte get()
         throws ReadFailedException
Read in a single byte.

Returns:
The byte that was read.
Throws:
ReadFailedException

getChar

char getChar()
             throws ReadFailedException
Read in two bytes. Done in the correct byte order.

Returns:
The 2 byte integer that was read.
Throws:
ReadFailedException

get3

int get3()
         throws ReadFailedException
Get a 3byte signed quantity.

Returns:
The value read.
Throws:
ReadFailedException - When the file cannot be read.

getu3

int getu3()
          throws ReadFailedException
Get a 3byte unsigned quantity.

Returns:
The value read.
Throws:
ReadFailedException - When the file cannot be read.

getInt

int getInt()
           throws ReadFailedException
Read in a 4 byte value.

Returns:
A 4 byte integer.
Throws:
ReadFailedException

get

byte[] get(int len)
           throws ReadFailedException
Read in an arbitrary length sequence of bytes.

Parameters:
len - The number of bytes to read.
Throws:
ReadFailedException

getZString

java.lang.String getZString()
                            throws ReadFailedException
Read a zero terminated string from the file.

Returns:
A string
Throws:
ReadFailedException - For failures.

getBase11str

java.lang.String getBase11str(byte firstChar,
                              char delimiter)
Read in a string of digits in the compressed base 11 format that is used for phone numbers in the POI section.

Parameters:
delimiter - This will replace all digit 11 characters. Usually a '-' to separate numbers in a telephone. No doubt there is a different standard in each country.
Returns:
A phone number possibly containing the delimiter character.