org.free.garminimg
Class ImgSubFile

java.lang.Object
  extended by org.free.garminimg.ImgSubFile
Direct Known Subclasses:
TreSubFile, UnknownSubFile

public abstract class ImgSubFile
extends java.lang.Object

One sub-file within a .img file.


Nested Class Summary
static class ImgSubFile.FileContext
           
 
Field Summary
protected  ImgFileBag fileBag
           
protected  int headerLength
           
 
Constructor Summary
ImgSubFile(java.lang.String filename, java.lang.String filetype, int fileSize, int blocSize, ImgFileBag fileBag)
           
 
Method Summary
 void addBloc(long bloc)
           
static ImgSubFile create(java.lang.String filename, java.lang.String filetype, int fileSize, int blocSize, ImgFileBag fileBag)
           
 void debugPrintHex(ImgSubFile.FileContext context, long startOffset, long length)
           
 long getAbsolutePosition(long relative)
           
 java.lang.String getFilename()
           
 int getFileSize()
           
 java.lang.String getFiletype()
           
protected  int getHeaderLength()
           
 int getLocked()
           
 long getLockedPos()
           
 long getNextReadPos(ImgSubFile.FileContext context)
           
abstract  void init()
           
 void printDebug(java.io.PrintStream out)
           
 int readByte(ImgSubFile.FileContext context)
           
 int readInt16(ImgSubFile.FileContext context)
           
 int readInt24(ImgSubFile.FileContext context)
           
 java.lang.String readString(int len, ImgSubFile.FileContext context)
           
 int readUInt16(ImgSubFile.FileContext context)
           
 int readUInt24(ImgSubFile.FileContext context)
           
 long readUInt32(ImgSubFile.FileContext context)
           
 void seek(long pos, ImgSubFile.FileContext context)
           
protected  void superInit(ImgSubFile.FileContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

headerLength

protected int headerLength

fileBag

protected ImgFileBag fileBag
Constructor Detail

ImgSubFile

public ImgSubFile(java.lang.String filename,
                  java.lang.String filetype,
                  int fileSize,
                  int blocSize,
                  ImgFileBag fileBag)
Method Detail

create

public static ImgSubFile create(java.lang.String filename,
                                java.lang.String filetype,
                                int fileSize,
                                int blocSize,
                                ImgFileBag fileBag)

init

public abstract void init()
                   throws java.io.IOException
Throws:
java.io.IOException

superInit

protected void superInit(ImgSubFile.FileContext context)
                  throws java.io.IOException
Throws:
java.io.IOException

getLockedPos

public long getLockedPos()
Returns:
Position of the locked byte relative to the start of the sub-file.

addBloc

public void addBloc(long bloc)

getFilename

public java.lang.String getFilename()

getFileSize

public int getFileSize()

getFiletype

public java.lang.String getFiletype()

getHeaderLength

protected int getHeaderLength()

getLocked

public int getLocked()

getAbsolutePosition

public long getAbsolutePosition(long relative)
                         throws java.io.EOFException
Parameters:
relative - The position relative to the start of the sub-file
Returns:
The position relative to the start of the IMG file.
Throws:
java.io.EOFException

seek

public void seek(long pos,
                 ImgSubFile.FileContext context)
          throws java.io.IOException
Throws:
java.io.IOException

getNextReadPos

public long getNextReadPos(ImgSubFile.FileContext context)

readByte

public int readByte(ImgSubFile.FileContext context)
             throws java.io.IOException
Throws:
java.io.IOException

readString

public java.lang.String readString(int len,
                                   ImgSubFile.FileContext context)
                            throws java.io.IOException
Throws:
java.io.IOException

readUInt16

public int readUInt16(ImgSubFile.FileContext context)
               throws java.io.IOException
Throws:
java.io.IOException

readUInt24

public int readUInt24(ImgSubFile.FileContext context)
               throws java.io.IOException
Throws:
java.io.IOException

readUInt32

public long readUInt32(ImgSubFile.FileContext context)
                throws java.io.IOException
Throws:
java.io.IOException

readInt16

public int readInt16(ImgSubFile.FileContext context)
              throws java.io.IOException
Throws:
java.io.IOException

readInt24

public int readInt24(ImgSubFile.FileContext context)
              throws java.io.IOException
Throws:
java.io.IOException

printDebug

public void printDebug(java.io.PrintStream out)
                throws java.io.IOException
Throws:
java.io.IOException

debugPrintHex

public void debugPrintHex(ImgSubFile.FileContext context,
                          long startOffset,
                          long length)
                   throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2008. All Rights Reserved.