⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 garminini.java

📁 基于Java的地图数据管理软件。使用MySQL数据库管理系统。
💻 JAVA
字号:
package net.aetherial.gis.garmin;
import java.io.*;
import java.util.*;
import net.aetherial.gis.surface.ItemValue;
/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2004</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class GarminIni {
  public static String FileOpenPath = "";
  public static String FileSavePath = "";
  public static String ExcelSavePath = "";
  public static String City = "";
  public static String County = "";
  public static String Town = "";

  public GarminIni() {

  }
  public static void read(){

    try
            {
                    BufferedReader in = new BufferedReader (new InputStreamReader (new FileInputStream ("Garmin.ini")));
                    String line = new String ("");

                    int i = 0;
                    for (line = in.readLine (); line != null; line = in.readLine (), i++)
                    {
                            if (! (line.startsWith ("#")))
                            {
                                    StringTokenizer st = new StringTokenizer (line, "=");
                                    String name = st.nextToken ().trim ();
                                    String value = st.nextToken ().trim ();
                                    if (name.equals ("Serial Port"))
                                    {
                                    }
                                    else if (name.equals ("Server"))
                                    {
                                    }
                                    else if (name.equals ("Server Port"))
                                    {
                                    }
                                    else if (name.equals ("FileOpenPath"))
                                    {
                                            FileOpenPath = value;

                                            System.out.println("FileOpenPath:"+FileOpenPath);
                                    }
                                    else if (name.equals ("FileSavePath"))
                                    {
                                            FileSavePath = value;
                                    }
                                    else if (name.equals ("ExcelSavePath"))
                                    {
                                            ExcelSavePath = value;
                                    }
                                    else if (name.equals ("City"))
                                    {
                                            City = value;
                                    }
                                    else if (name.equals ("County"))
                                    {
                                            County = value;
                                    }
                                    else if (name.equals ("Town"))
                                    {
                                            Town = value;
                                    }
                                    else
                                    {
                                            System.err.println ("Error in configuration file Garmin.ini, line "+i+": "+line);
                                    }
                            }
                    }

                    in.close ();
            }
            catch (FileNotFoundException e)
            {
              System.err.println ("Can not found Garmin.ini");
            }
            catch (IOException e)
            {
                    System.err.println ("Error reading Garmin.ini");
            }

  }

  public static void write(){
    BufferedReader in = null;
    BufferedWriter out = null;
    String text = "",line = "";
    StringTokenizer st = null;
    String name = "";

    try {
      in = new BufferedReader(new InputStreamReader(new FileInputStream(
          ConsoleConfig.cfgFile)));
      while((line = in.readLine())!=null){
        st = new StringTokenizer (line, "=");
        name = st.nextToken ().trim ();
        if(name.equals("Serial Port")){
          text = text + "Serial Port = "+ ItemValue.portCanUse + "\r\n";
        }else if(name.equals("FileOpenPath")){
          text = text + "FileOpenPath = "+ FileOpenPath +"\r\n";
        }else if(name.equals("FileSavePath")){
          text = text + "FileSavePath = "+ FileSavePath +"\r\n";
        }else if(name.equals("ExcelSavePath")){
          text = text + "ExcelSavePath = "+ ExcelSavePath +"\r\n";
        }else if(name.equals("City")){
          text = text + "City = "+ City +"\r\n";
        }else if(name.equals("County")){
          text = text + "County = "+ County +"\r\n";
        }else if(name.equals("Town")){
          text = text + "Town = "+ Town +"\r\n";
        }else{
          text = text + line +"\r\n";
        }
      }
      FileOutputStream fos = new FileOutputStream(new File(ConsoleConfig.cfgFile));
      fos.write(text.getBytes());
      fos.flush();
    }
    catch (Exception ex) {
    }

  }
  public static void main(String[] args) {
    GarminIni garminini = new GarminIni();
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -