1 package gov
.nasa
.worldwind
.formats
.rpf
;
3 import gov
.nasa
.worldwind
.*;
4 import gov
.nasa
.worldwind
.formats
.nitfs
.*;
9 Copyright (C) 2001, 2007 United States Government
10 as represented by the Administrator of the
11 National Aeronautics and Space Administration.
16 * @author Lado Garakanidze
17 * @version $Id: RpfTocFile Apr 4, 2007 2:24:00 PM lado
19 public class RpfTocFile
extends RpfFile
21 private RpfFileComponents rpfFileComponents
;
23 public RpfHeaderSection
getHeaderSection()
25 return (null != this.rpfFileComponents
) ?
this.rpfFileComponents
.getRpfHeaderSection() : null;
28 public RpfFrameFileIndexSection
getFrameFileIndexSection()
30 return (null != this.rpfFileComponents
) ?
this.rpfFileComponents
.getRpfFrameFileIndexSection() : null;
33 public RpfFileComponents
getRpfFileComponents()
35 return this.rpfFileComponents
;
38 protected RpfTocFile(java
.io
.File rpfFile
) throws IOException
, NitfsRuntimeException
42 RpfUserDefinedHeaderSegment segment
=
43 (RpfUserDefinedHeaderSegment
)this.getNitfsSegment( NitfsSegmentType
.UserDefinedHeaderSegment
);
46 throw new NitfsRuntimeException("NitfsReader.UserDefinedHeaderSegmentWasNotFound");
48 this.rpfFileComponents
= segment
.getRpfFileComponents();
49 if(null == this.rpfFileComponents
)
50 throw new NitfsRuntimeException("NitfsReader.RpfFileComponents.Were.Not.Found.In.UserDefinedHeaderSegment");
53 public static RpfTocFile
load(java
.io
.File tocFile
) throws java
.io
.IOException
55 return new RpfTocFile(tocFile
);
58 public static void main(String args
[])
60 String testTocFilename
= (Configuration
.isWindowsOS()) ?
"C:\\RPF\\A.TOC" : "/depot/WorldWindJ/utils/rpf/A.TOC";
63 long startTime
= System
.currentTimeMillis();
65 RpfTocFile toc
= RpfTocFile
.load(new File(testTocFilename
));
67 System
.out
.println(MessageFormat
.format("TOC file loaded in {0} mSec", (System
.currentTimeMillis() - startTime
)));
71 System
.out
.println(e
.getMessage());