Package com.bbn.openmap.io

Examples of com.bbn.openmap.io.BinaryBufferedFile


            if (Debug.debugging("maketoc")) {
                Debug.output("MakeToc: frame number " + i + ", " + framePath);
            }

            try {
                BinaryFile binFile = new BinaryBufferedFile(framePath);

                // Frame file names are 8.3 notation, might want to
                // check
                // that here, to blow off dummy files.
                String fn = binFile.getName();
                if (fn.length() != 12) {
                    // Not a RPF Frame file
                    if (Debug.debugging("maketoc")) {
                        Debug.error("MakeToc: " + framePath
                                + " is not a RPF image file - ignoring");
                    }
                    continue;
                }

                RpfFileSections rfs = new RpfFileSections();

                binFile.seek(0);

                if (!head.read(binFile)) {
                    // Not a RPF Frame file
                    if (Debug.debugging("maketoc")) {
                    Debug.error("MakeToc: " + framePath
                                + " is not a RPF image file - ignoring");
                    }
                    continue;
                }

                binFile.seek(head.locationSectionLocation);

                rfs.parse(binFile);
                coverage = rfs.parseCoverageSection(binFile);

                if (coverage == null) {
                    Debug.error("MakeToc: error reading coverage section for "
                            + framePath + ", (file " + i + ") skipping");

                    binFile.close();
                    continue;
                }

                if (Debug.debugging("maketocframedetail")) {
                    Debug.output("MakeToc.organizeFrames: coverage section for "
                            + framePath + ", " + coverage);
                }

                binFile.close();
                binFile = null;

            } catch (FileNotFoundException e) {
                Debug.error("MakeToc: " + framePath
                        + " not found, being ignored.");
View Full Code Here


     * @return The DbfTableModel, null if there is a problem.
     */
    public static DbfTableModel getDbfTableModel(String dbf) {
        DbfFile model = null;
        try {
            BinaryBufferedFile bbf = new BinaryBufferedFile(dbf);
            model = new DbfFile(bbf);
            model.close();
        } catch (Exception exception) {
            if (Debug.debugging("shape")) {
                Debug.error("problem loading DBF file" + exception.getMessage());
View Full Code Here

     * @return a RpfAttributes object.
     */
    public static RpfAttributes getAttributes(String filename)
            throws IOException, FileNotFoundException {

        BinaryFile binFile = new BinaryBufferedFile(filename);

        RpfHeader head = new RpfHeader();
        head.read(binFile);

        RpfAttributes att = getAttributes(binFile);
        binFile.close();
        head = null;
        return att;
    }
View Full Code Here

     *        read in per longitude column depending on the need.
     *        False is recommended for DTEd level 1 and 2.
     */
    public DTEDFrame(String filePath, boolean readWholeFile) {
        try {
            binFile = new BinaryBufferedFile(filePath);

            read(binFile, readWholeFile);
            if (readWholeFile)
                close(true);
            else
View Full Code Here

     *
     * @return true if the opening was successful.
     */
    protected boolean reopen() {
        try {
            binFile = new BinaryBufferedFile(path);
            return true;
        } catch (FileNotFoundException e) {
            Debug.error("DTEDFrame reopen(): file " + path + " not found");
            return false;
        } catch (IOException e) {
View Full Code Here

     */
    public boolean readCoverageFile(String coverage) {
        try {
            Debug.message("dtedcov",
                    "DTEDCoverageManager: Reading coverage file - " + coverage);
            BinaryBufferedFile binFile = new BinaryBufferedFile(coverage);
            level0Frames = new boolean[180][];
            level1Frames = new boolean[180][];
            level2Frames = new boolean[180][];

            byte[] row = new byte[360];

            for (int level = 0; level < 3; level++) {
                for (int lat = 0; lat < 180; lat++) {
                    binFile.read(row);

                    if (level == 0)
                        level0Frames[lat] = convertBytesToBooleans(row);
                    else if (level == 1)
                        level1Frames[lat] = convertBytesToBooleans(row);
View Full Code Here

     * @return whether the file was read! True means yes.
     */
    protected boolean readCoverageFile(String urlCov, String coverage) {
        URL url = null;
        BufferedInputStream bin = null;
        BinaryBufferedFile binFile = null;

        level0Frames = null;
        level1Frames = null;
        level2Frames = null;

        if (urlCov != null) {
            Debug.message("dtedcov",
                    "DTEDCoverageManager: Reading coverage file from URL - "
                            + urlCov);
            try {
                url = new URL(urlCov);
                bin = new BufferedInputStream(url.openStream());
            } catch (MalformedURLException mue) {
                System.err.println("DTEDCoverageManager: Weird URL given : \""
                        + urlCov + "\"");
                bin = null;
            } catch (java.io.IOException e) {
                System.err.println("DTEDCoverageManager: Unable to read coverage file at \""
                        + urlCov + "\"");
                bin = null;
            }
        }

        if (bin == null && coverage != null) {
            try {
                Debug.message("dtedcov",
                        "DTEDCoverageManager: Reading coverage file - "
                                + coverage);
                binFile = new BinaryBufferedFile(coverage);
            } catch (java.io.IOException e) {
                System.err.println("DTEDCoverageManager: Unable to read coverage file at \""
                        + coverage + "\"");
            }
        }

        if (bin != null || binFile != null) {
            try {
                level0Frames = new boolean[180][];
                level1Frames = new boolean[180][];
                level2Frames = new boolean[180][];

                byte[] row = new byte[360];

                for (int level = 0; level < 3; level++) {
                    for (int lat = 0; lat < 180; lat++) {

                        if (bin != null) {
                            for (int k = 0; k < row.length; k++) {
                                row[k] = (byte) bin.read();
                            }
                        } else
                            binFile.read(row);

                        if (level == 0)
                            level0Frames[lat] = convertBytesToBooleans(row);
                        else if (level == 1)
                            level1Frames[lat] = convertBytesToBooleans(row);
View Full Code Here

        Debug.output("DTEDFrameACC: using frame " + args[0]);

        java.io.File file = new java.io.File(args[0]);

        try {
            BinaryFile binFile = new BinaryBufferedFile(file);

            // BinaryFile binFile = new BinaryFile(file);
            DTEDFrameACC dfa = new DTEDFrameACC(binFile);

            Debug.output(dfa.toString());
View Full Code Here

                if (Debug.debugging("dted")) {
                    Debug.output("DTEDAdmin copying " + file.getAbsolutePath()
                            + " to " + outputFile.getAbsolutePath());
                }

                BinaryBufferedFile input = new BinaryBufferedFile(file);
                RandomAccessFile output = new RandomAccessFile(outputFile, "rw");
                byte[] bytes = new byte[4096];
                int numBytes = input.read(bytes);
                while (numBytes > 0) {
                    output.write(bytes, 0, numBytes);
                    numBytes = input.read(bytes);
                }

                input.close();
                output.close();

            } catch (FormatException fe) {
                continue;
            } catch (IOException ioe) {
View Full Code Here

        Debug.output("DTEDFrameUHL: using frame " + args[0]);

        java.io.File file = new java.io.File(args[0]);

        try {
            BinaryFile binFile = new BinaryBufferedFile(file);

            //        BinaryFile binFile = new BinaryFile(file);
            DTEDFrameUHL dfu = new DTEDFrameUHL(binFile);

            Debug.output(dfu.toString());
View Full Code Here

TOP

Related Classes of com.bbn.openmap.io.BinaryBufferedFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.