package cn.com.css.common.util;

/**

 * @brief OSEnum.java 操作系统的枚举

 * @attention

 * @author 涂作权

 * @date 2014年4月3日

 * @note begin modify by null

 */

public enum EOSPlatForm {

 Any("any"),

 Linux("Linux"),

 Mac_OS("Mac OS"),

 Mac_OS_X("Mac OS X"),

 Windows("Windows"),

 OS2("OS/2"),

 Solaris("Solaris"),

 SunOS("SunOS"),

 MPEiX("MPE/iX"),

 HP_UX("HP-UX"),

 AIX("AIX"),

 OS390("OS/390"),

 FreeBSD("FreeBSD"),

 Irix("Irix"),

 Digital_Unix("Digital Unix"),

 NetWare_411("NetWare"),

 OSF1("OSF1"),

 OpenVMS("OpenVMS"),

 Others("Others");

/** 描写叙述信息 **/

 private String description;

/**

  * @param desc 描写叙述信息

  */

 EOSPlatForm(String desc) {

  this.description = desc;

 }

public String getDescription() {

  return description;

 }

public void setDescription(String description) {

  this.description = description;

 }

}

package cn.com.css.common.util;

/**

 * @brief OSInfo.java 通过这个类获得操作信息信息

 * @attention

 * @author 涂作权

 * @date 2014年4月3日

 * @note begin modify by null

 */

public class OSInfo {

 /** 操作系统名称 **/

 private static String OS_NAME = System.getProperty("os.name").toLowerCase();

 private static OSInfo osInfoInstance = new OSInfo();

 private EOSPlatForm osPlatForm;

private OSInfo() {

 }

/**

  * \brief 推断是否是Linux操作系统

  *

  * @return

  * @attention

  * @author 涂作权

  * @date 2014年4月3日

  * @note begin modify by null

  */

 public static boolean isLinux() {

  return OS_NAME.indexOf("linux") >= 0;

 }

/**

  * \brief 推断是否是MacOS操作系统

  *

  * @return

  * @attention

  * @author 涂作权

  * @date 2014年4月3日

  * @note begin modify by null

  */

 public static boolean isMacOS() {

  return OS_NAME.indexOf("mac") >= 0 && OS_NAME.indexOf("os") > 0

    && OS_NAME.indexOf("x") < 0;

 }

/**

  * \brief 推断是否是MacOSX操作系统

  *

  * @return

  * @attention

  * @author 涂作权

  * @date 2014年4月3日

  * @note begin modify by null

  */

 public static boolean isMacOSX() {

  return OS_NAME.indexOf("mac") >= 0 && OS_NAME.indexOf("os") > 0

    && OS_NAME.indexOf("x") > 0;

 }

/**

  * \brief 推断是否是windows操作系统

  *

  * @return

  * @attention

  * @author 涂作权

  * @date 2014年4月3日

  * @note begin modify by null

  */

 public static boolean isWindows() {

  return OS_NAME.indexOf("windows") >= 0;

 }

/**

  * \brief 推断是否是OS2操作系统

  *

  * @return

  * @attention 方法的使用注意事项

  * @author Administrator

  * @date 2014-4-3

  * @note begin modify by 改动人 改动时间 改动内容摘要说明

  */

 public static boolean isOS2() {

  return OS_NAME.indexOf("os/2") >= 0;

 }

public static boolean isSolaris() {

  return OS_NAME.indexOf("solaris") >= 0;

 }

public static boolean isSunOS() {

  return OS_NAME.indexOf("sunos") >= 0;

 }

public static boolean isMPEiX() {

  return OS_NAME.indexOf("mpe/ix") >= 0;

 }

public static boolean isHPUX() {

  return OS_NAME.indexOf("hp-ux") >= 0;

 }

public static boolean isAix() {

  return OS_NAME.indexOf("aix") >= 0;

 }

public static boolean isOS390() {

  return OS_NAME.indexOf("os/390") >= 0;

 }

public static boolean isFreeBSD() {

  return OS_NAME.indexOf("freebsd") >= 0;

 }

public static boolean isIrix() {

  return OS_NAME.indexOf("irix") >= 0;

 }

public static boolean isDigitalUnix() {

  return OS_NAME.indexOf("digital") >= 0 && OS_NAME.indexOf("unix") > 0;

 }

public static boolean isNetWare() {

  return OS_NAME.indexOf("netware") >= 0;

 }

public static boolean isOSF1() {

  return OS_NAME.indexOf("osf1") >= 0;

 }

public static boolean isOpenVMS() {

  return OS_NAME.indexOf("openvms") >= 0;

 }

/**

  * \brief 获得操作系统的名称

  *

  * @return

  * @attention

  * @author 涂作权

  * @date 2014年4月3日

  * @note begin modify by null

  */

 public static EOSPlatForm getOSName() {

  if (isAix()) {

   osInfoInstance.osPlatForm = EOSPlatForm.AIX;

  } else if (isDigitalUnix()) {

   osInfoInstance.osPlatForm = EOSPlatForm.Digital_Unix;

  } else if (isFreeBSD()) {

   osInfoInstance.osPlatForm = EOSPlatForm.FreeBSD;

  } else if (isHPUX()) {

   osInfoInstance.osPlatForm = EOSPlatForm.HP_UX;

  } else if (isIrix()) {

   osInfoInstance.osPlatForm = EOSPlatForm.Irix;

  } else if (isLinux()) {

   osInfoInstance.osPlatForm = EOSPlatForm.Linux;

  } else if (isMacOS()) {

   osInfoInstance.osPlatForm = EOSPlatForm.Mac_OS;

  } else if (isMacOSX()) {

   osInfoInstance.osPlatForm = EOSPlatForm.Mac_OS_X;

  } else if (isMPEiX()) {

   osInfoInstance.osPlatForm = EOSPlatForm.MPEiX;

  } else if (isNetWare()) {

   osInfoInstance.osPlatForm = EOSPlatForm.NetWare_411;

  } else if (isOpenVMS()) {

   osInfoInstance.osPlatForm = EOSPlatForm.OpenVMS;

  } else if (isOS2()) {

   osInfoInstance.osPlatForm = EOSPlatForm.OS2;

  } else if (isOS390()) {

   osInfoInstance.osPlatForm = EOSPlatForm.OS390;

  } else if (isOSF1()) {

   osInfoInstance.osPlatForm = EOSPlatForm.OSF1;

  } else if (isSolaris()) {

   osInfoInstance.osPlatForm = EOSPlatForm.Solaris;

  } else if (isSunOS()) {

   osInfoInstance.osPlatForm = EOSPlatForm.SunOS;

  } else if (isWindows()) {

   osInfoInstance.osPlatForm = EOSPlatForm.Windows;

  } else {

   osInfoInstance.osPlatForm = EOSPlatForm.Others;

  }

  return osInfoInstance.osPlatForm;

 }

// public static void main(String[] args) {

//  System.out.println(OSInfo.getOSName());

//  System.out.println(osInfoInstance.osPlatForm.getDescription());

//  System.out.println(System.getProperty("os.name"));

//  System.out.println(System.getProperty("os.version"));

//  System.out.println(System.getProperty("os.arch"));

// }

}

package cn.com.css.misps.graph.util;

import java.io.File;

import java.io.InputStream;

import java.util.Calendar;

import java.util.Date;

import java.util.Properties;

import cn.com.css.common.util.OSInfo;

/**

 * @brief StoragePathUtils.java 图形产品存储相关的类

 * @attention 要注意的是:图形产品的存储路径要兼容Linux的。

 * @author 涂作权

 * @date 2013-9-23

 * @note begin modify by null

 */

public final class ProductsStorageUtils
{

 

 public static Calendar calendar;

// 图形产品相应的绝对路径

 public static String graphAbsolutePath;

 // 图形产品中相应的虚拟路径

 public static String graphVirtualPath;

 // 文字产品相应的绝对路径

 public static String wordAbsolutePath;

 // 文字产品相应的虚拟路径

 public static String wordVirtualPath;

 // micaps磁盘挂接过来的源文件的路径

 public static String micapsAbsolutePath;

 // micaps虚拟路径

 public static String micapsVirtualPath;

// 图形产品今天的文件存储路径

 public static String graphTodayStoragePath;

 // 图形产品明天的文件存储路径

 public static String graphTomorrowStoragePath;

 // 图形产品文件存储的相对路径

 public static String graphRelativeStoragePath;

// 文字产品今天的文件存储路径

 public static String wordTodayStoragePath;

 // 文字产品明天的文件存储路径

 public static String wordTomorrowStoragePath;

 // 文字产品文件存储的相对路径

 public static String wordRelativeStoragePath;

 // 认证文件存放的位置

 public static String authenticationPath;

 // 认证文件存放的相对路径

 public static String authenticationTodayPath;

 // 认证文件第二天要存放的位置

 public static String authenticationTomorrowPath;

 

 /** graphTemp文件存储的暂时文件夹存储位置  **/

 public static String graphTempAbsolutePath;

 /** graphTemp相应的虚拟文件夹 **/

 public static String graphTempVirtualPath;

 /** 指定数据源时间存储的位置  **/

 public static String graphTempTodayStoragePath;

 /** 指定数据源第二天存储的位置 **/

 public static String graphTempTomorrowStoragePath;

 /** 在暂时文件夹里的相对路径**/

 public static String graphTempRelativeStoragePath;

public ProductsStorageUtils() {

 }

 

 /**

  * \brief 编写此方法的目的是获得指定时间的这些对应数据。

  *

  * @param date

  * @return

  * @attention 假设不调用这种方法。则表示当天相应的这些数据

  * @author 涂作权

  * @date 2014-5-23

  * @note begin modify by 改动人 改动时间 改动内容摘要说明

  */

 @SuppressWarnings("static-access")

 public static ProductsStorageUtils changeCalendar(Date date) {

  ProductsStorageUtils ps = new ProductsStorageUtils();

  ps.calendar.setTime(date);

  return ps;

 }

/**

  * 静态代码块

  */

 static {

  try {

   // 使用默认时区和语言环境获得一个日历

   calendar = Calendar.getInstance();

   // 今年

   int year = calendar.get(Calendar.YEAR);

   // 当月

   int month = calendar.get(Calendar.MONTH) + 1;

   // 当天

   int day = calendar.get(Calendar.DAY_OF_MONTH);

   // 明天

   int tomorrow = day + 1;

InputStream in = null;

// 推断操作系统类型

   switch (OSInfo.getOSName()) {

   case Windows:

    // 读取配置文件,通过类载入的方式读取属性文件

    in = ProductsStorageUtils.class.getClassLoader()

      .getResourceAsStream("windows_storagepath.properties");

    break;

   case Linux:

    in = ProductsStorageUtils.class.getClassLoader()

      .getResourceAsStream("Linux_storagepath.properties");

    break;

   default:

    break;

   }

Properties prop = new Properties();

   prop.load(in);

// 图形产品相应的绝对路径

   graphAbsolutePath = prop.getProperty("productAbsolutePath")

     + File.separator + "graph";

   // 图形产品中相应的虚拟路径

   graphVirtualPath = prop.getProperty("graphVirtualPath");

   // 文字产品相应的绝对路径

   wordAbsolutePath = prop.getProperty("productAbsolutePath")

     + File.separator + "word";

   // 文字产品相应的虚拟路径

   wordVirtualPath = prop.getProperty("wordVirtualPath");

   // micaps磁盘挂接过来的源文件的路径

   micapsAbsolutePath = prop.getProperty("micapsAbsolutePath");

   // micaps虚拟路径

   micapsVirtualPath = prop.getProperty("micapsVirtualPath");

   // 图片暂时文件夹存储位置

   graphTempAbsolutePath = prop.getProperty("graphTempAbsolutePath");

   graphTempVirtualPath = prop.getProperty("graphTempVirtualPath");

// 获取图形产品文件存储的根路径

   graphTodayStoragePath = graphAbsolutePath + File.separator + year

     + File.separator + ((month > 9) ?

month : "0" + month)

     + File.separator + ((day > 9) ?

day : "0" + day);

   // 明天图形产品文件的存储路径

   graphTomorrowStoragePath = graphAbsolutePath + File.separator

     + year + File.separator

     + ((month > 9) ? month : "0" + month) + File.separator

     + ((tomorrow > 9) ?

tomorrow : "0" + tomorrow);

   // 图形产品文件存储的相对路径

   graphRelativeStoragePath = "/" + year + "/"

     + ((month > 9) ? month : "0" + month) + "/"

     + ((day > 9) ?

day : "0" + day);

   

   // 获取暂时图形产品文件存储的根路径

   graphTempTodayStoragePath = graphTempAbsolutePath + File.separator + year

     + File.separator + ((month > 9) ? month : "0" + month)

     + File.separator + ((day > 9) ? day : "0" + day);

   // 明天图形产品文件的存储路径

   graphTempTomorrowStoragePath = graphTempAbsolutePath + File.separator

     + year + File.separator

     + ((month > 9) ? month : "0" + month) + File.separator

     + ((tomorrow > 9) ? tomorrow : "0" + tomorrow);

   // 图形产品文件存储的相对路径

   graphTempRelativeStoragePath = "/" + year + "/"

     + ((month > 9) ? month : "0" + month) + "/"

     + ((day > 9) ?

day : "0" + day);

// 获取文字产品文件存储的根路径

   wordTodayStoragePath = wordAbsolutePath + File.separator + year

     + File.separator + ((month > 9) ?

month : "0" + month)

     + File.separator + ((day > 9) ?

day : "0" + day);

   // 明天文字产品文件的存储路径

   wordTomorrowStoragePath = wordAbsolutePath + File.separator + year

     + File.separator + ((month > 9) ?

month : "0" + month)

     + File.separator

     + ((tomorrow > 9) ? tomorrow : "0" + tomorrow);

   // 文字产品文件相对路径

   wordRelativeStoragePath = "/" + year + "/"

     + ((month > 9) ? month : "0" + month) + "/"

     + ((day > 9) ? day : "0" + day);

// 认证文件存放的位置

   authenticationPath = prop.getProperty("authenticationPath");

   // 认证文件当天存放的位置

   authenticationTodayPath = authenticationPath + File.separator

     + year + File.separator

     + ((month > 9) ?

month : "0" + month) + File.separator

     + ((day > 9) ? day : "0" + day);

   // 认证文件明天存放的位置

   authenticationTomorrowPath = authenticationPath + File.separator

     + year + File.separator

     + ((month > 9) ? month : "0" + month) + File.separator

     + ((tomorrow > 9) ? tomorrow : "0" + tomorrow);

// 关闭流

   in.close();

   in = null;

  } catch (Exception e) {

   e.printStackTrace();

  }

 }

 

 /**

  * \brief 创建图形产品明天文件存储的文件文件夹

  *

  * @attention

  *

  * @author 涂作权

  * @date 2013-10-6

  * @note begin modify by 涂作权 2014-02-13

  */

 public static void createGraphTomorrowStorageFolder() {

  // 推断该目录是否存在,假设存在就不须要创建。假设不存在就创建

  File storageFolder = new File(graphTomorrowStoragePath);

  if (storageFolder.exists()) {

   return;

  } else {

   // 创建目录

   storageFolder.mkdirs();

   return;

  }

 }

/**

  * \brief 创建指定数据源时间的图形产品明天文件存储的文件文件夹

  *

  * @param date:指定的数据源时间

  *

  * @attention

  *

  * @author 涂作权

  * @date 2014-5-23

  * @note begin modify by 涂作权

  */

 @SuppressWarnings("static-access")

 public static void createGraphTomorrowStorageFolder(Date date) {

  // 推断该目录是否存在。假设存在就不须要创建。假设不存在就创建

  File storageFolder = new File(changeCalendar(date).graphTomorrowStoragePath);

  if (storageFolder.exists()) {

   return;

  } else {

   // 创建目录

   storageFolder.mkdirs();

   return;

  }

 }

/**

  * \brief 创建今天的文件存储路径

  *

  * @attention

  * @author 涂作权

  * @date 2014-5-23

  * @note begin modify by 涂作权

  */

 public static void createGraphTodayStorageFolder() {

  // 推断该目录是否存在,假设存在就不须要创建,假设不存在就创建

  File storageFolder = new File(graphTodayStoragePath);

  if (storageFolder.exists()) {

   return;

  } else {

   // 创建目录

   storageFolder.mkdirs();

   return;

  }

 }

/**

  * \brief 创建指定的数据源时间的那天的文件存储路径

  *

  * @param date:指定的数据源时间

  * @attention

  * @author 涂作权

  * @date 2014-5-23

  * @note begin modify by 涂作权

  */

 @SuppressWarnings("static-access")

 public static void createGraphTodayStorageFolder(Date date) {

  // 推断该目录是否存在,假设存在就不须要创建。假设不存在就创建

  File storageFolder = new File(

    changeCalendar(date).graphTodayStoragePath);

  if (storageFolder.exists()) {

   return;

  } else {

   // 创建目录

   storageFolder.mkdirs();

   return;

  }

 }

 

 /**

  * \brief 创建图形产品明天文件存储的文件文件夹

  *

  * @attention

  *

  * @author 涂作权

  * @date 2013-10-6

  * @note begin modify by 涂作权 2014-02-13

  */

 public static void createGraphTempTomorrowStorageFolder() {

  // 推断该目录是否存在,假设存在就不须要创建,假设不存在就创建

  File storageFolder = new File(graphTempTomorrowStoragePath);

  if (storageFolder.exists()) {

   return;

  } else {

   // 创建目录

   storageFolder.mkdirs();

   return;

  }

 }

 

 /**

  * \brief 创建指定数据源时间的图形产品明天文件存储的文件文件夹

  *

  * @param date:指定的数据源时间

  *

  * @attention

  *

  * @author 涂作权

  * @date 2014-5-23

  * @note begin modify by 涂作权

  */

 @SuppressWarnings("static-access")

 public static void createGraphTempTomorrowStorageFolder(Date date) {

  // 推断该目录是否存在。假设存在就不须要创建,假设不存在就创建

  File storageFolder = new File(changeCalendar(date).graphTempTomorrowStoragePath);

  if (storageFolder.exists()) {

   return;

  } else {

   // 创建目录

   storageFolder.mkdirs();

   return;

  }

 }

 

 /**

  * \brief 创建今天的文件存储路径

  *

  * @attention

  * @author 涂作权

  * @date 2014-5-23

  * @note begin modify by 涂作权

  */

 public static void createGraphTempTodayStorageFolder() {

  // 推断该目录是否存在。假设存在就不须要创建。假设不存在就创建

  File storageFolder = new File(graphTempTodayStoragePath);

  if (storageFolder.exists()) {

   return;

  } else {

   // 创建目录

   storageFolder.mkdirs();

   return;

  }

 }

 

 /**

  * \brief 创建指定的数据源时间的那天的文件存储路径

  *

  * @param date:指定的数据源时间

  * @attention

  * @author 涂作权

  * @date 2014-5-23

  * @note begin modify by 涂作权

  */

 @SuppressWarnings("static-access")

 public static void createGraphTempTodayStorageFolder(Date date) {

  // 推断该目录是否存在,假设存在就不须要创建,假设不存在就创建

  File storageFolder = new File(changeCalendar(date).graphTempTodayStoragePath);

  if (storageFolder.exists()) {

   return;

  } else {

   // 创建目录

   storageFolder.mkdirs();

   return;

  }

 }

/**

  * \brief 创建文字产品明天文件存储的文件文件夹

  *

  * @attention

  *

  * @author 涂作权

  * @date 2013-10-6

  * @note begin modify by 涂作权 2014-02-13

  */

 public static void createWordTomorrowStorageFolder() {

  // 推断该目录是否存在。假设存在就不须要创建,假设不存在就创建

  File storageFolder = new File(wordTomorrowStoragePath);

  if (storageFolder.exists()) {

   return;

  } else {

   // 创建目录

   storageFolder.mkdirs();

   return;

  }

 }

/**

  * \brief 创建指定数据源时间的后一天的文件存储的文件文件夹

  *

  * @param date :指定的数据源时间

  *

  * @attention

  *

  * @author 涂作权

  * @date 2014-5-23

  * @note begin modify by 涂作权

  */

 @SuppressWarnings("static-access")

 public static void createWordTomorrowStorageFolder(Date date) {

  // 推断该目录是否存在,假设存在就不须要创建,假设不存在就创建

  File storageFolder = new File(

    changeCalendar(date).wordTomorrowStoragePath);

  if (storageFolder.exists()) {

   return;

  } else {

   // 创建目录

   storageFolder.mkdirs();

   return;

  }

 }

/**

  * \brief 创建文字产品今天的文件存储路径

  *

  * @attention

  * @author 涂作权

  * @date 2013-10-6

  * @note begin modify by 涂作权 2014-02-13

  */

 public static void createWordTodayStorageFolder() {

  // 推断该目录是否存在,假设存在就不须要创建,假设不存在就创建

  File storageFolder = new File(wordTodayStoragePath);

  if (storageFolder.exists()) {

   return;

  } else {

   // 创建目录

   storageFolder.mkdirs();

   return;

  }

 }

/**

  * \brief 创建指定数据源时间的文字产品所在的文件存储路径

  *

  * @attention

  * @author 涂作权

  * @date 2014-05-23

  * @note begin modify by 涂作权

  */

 @SuppressWarnings("static-access")

 public static void createWordTodayStorageFolder(Date date) {

  // 推断该目录是否存在,假设存在就不须要创建。假设不存在就创建

  File storageFolder = new File(changeCalendar(date).wordTodayStoragePath);

  if (storageFolder.exists()){

   return;

  } else {

   // 创建目录

   storageFolder.mkdirs();

   return;

  }

 }

/**

  * \brief 创建认证文件当天存放文件的位置

  *

  * @attention

  * @author 涂作权

  * @date 2014-3-23

  * @note begin modify by null

  */

 public static void createAuthenticationTodayFolder() {

  // 推断该目录是否存在。假设存在就不须要创建。假设不存在就创建

  File storageFolder = new File(authenticationTodayPath);

  if (storageFolder.exists()) {

   return;

  } else {

   // 创建目录

   storageFolder.mkdirs();

   return;

  }

 }

/**

  * \brief 创建认证文件当天存放文件的位置

  *

  * @attention

  * @author 涂作权

  * @date 2014-3-23

  * @note begin modify by null

  */

 @SuppressWarnings("static-access")

 public static void createAuthenticationTodayFolder(Date date) {

  // 推断该目录是否存在。假设存在就不须要创建。假设不存在就创建

  File storageFolder = new File(changeCalendar(date).authenticationTodayPath);

  if (storageFolder.exists()) {

   return;

  } else {

   // 创建目录

   storageFolder.mkdirs();

   return;

  }

 }

/**

  * \brief 创建认证文件第二天应该应该存放的目录

  *

  * @attention

  * @author 涂作权

  * @date 2014-3-23

  * @note begin modify by null

  */

 public static void createAuthenticationTomorrowFolder() {

  File storageFolder = new File(authenticationTomorrowPath);

  if (storageFolder.exists()) {

   return;

  } else {

   // 创建目录

   storageFolder.mkdirs();

   return;

  }

 }

// @SuppressWarnings("static-access")

// public static void main(String[] args) throws IOException {

//  System.out.println(graphAbsolutePath);

//  System.out.println(graphVirtualPath);

//  System.out.println(graphRelativeStoragePath);

//  System.out.println(graphTodayStoragePath);

//  System.out.println(graphTomorrowStoragePath);

//  System.out.println(wordAbsolutePath);

//  System.out.println(wordVirtualPath);

//  System.out.println(wordRelativeStoragePath);

//  System.out.println(wordTodayStoragePath);

//  System.out.println(wordTomorrowStoragePath);

//  System.out.println(micapsAbsolutePath);

//  System.out.println(micapsVirtualPath);

//  System.out.println(authenticationPath);

//  System.out.println(authenticationTodayPath);

//  System.out.println(authenticationTomorrowPath);

//  createAuthenticationTodayFolder();

//  createAuthenticationTomorrowFolder();

//

//  System.out.println("--- test -- "

//    + changeCalendar(new Date()).graphRelativeStoragePath);

//  System.out.println(graphTempAbsolutePath);

//  System.out.println(graphTempVirtualPath);

//  System.out.println(graphTempTodayStoragePath);

//  System.out.println(graphTempTomorrowStoragePath);

//  System.out.println(graphTempRelativeStoragePath);

//  

//  createGraphTempTodayStorageFolder();

// }

}

依据不同的操作系统读取配置文件/java读取属性文件代码的更多相关文章

  1. java 读取txt,java读取大文件

    java 读取txt,java读取大文件 package com.bbcmart.util; import java.io.File;import java.io.RandomAccessFile;i ...

  2. Java操作属性文件,支持新增或更新多个属性

    Java操作属性文件.支持新增或更新多个属性 一.更新或新增单个属性的方法 /** * 写入properties信息 * @param filePath 绝对路径(包含文件名称和后缀名) * @par ...

  3. java:Properties属性文件概念

    java:Properties属性文件概念 在java之前的国际化程序中提出了一个属性文件的概念,属性文件的后缀是:*.properties,那么在java中提供了意个属性文件的专门操作类,Prope ...

  4. Spring依赖注入的方式、类型、Bean的作用域、自动注入、在Spring配置文件中引入属性文件

    1.Spring依赖注入的方式 通过set方法完成依赖注入 通过构造方法完成依赖注入 2.依赖注入的类型 基本数据类型和字符串 使用value属性 如果是指向另一个对象的引入 使用ref属性 User ...

  5. Java操作属性文件与国际化

    在前面讲到的java类集中的Hashtable中,有一个子类Properties,此类定义如下: public class Properties extends Hashtable<Object ...

  6. Java操作属性文件之工具类

    最近空闲时间整理一下平时常用的一下工具类,重复造轮子实在是浪费时间,如果不正确或者有待改善的地方,欢迎指教... package com.hsuchan.business.utils; import ...

  7. java上传文件代码

    import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.IOException;impo ...

  8. java解析属性文件

    -----------------------解析属性文件----------------------------- /**   * 获取src下属性文件   * @param params   * ...

  9. java读取配置文件方法以及工具类

    第一种方式 : java工具类读取配置文件工具类 只是案例代码  抓取异常以后的代码自己处理 import java.io.FileNotFoundException; import java.io. ...

随机推荐

  1. 基于visual Studio2013解决算法导论之006最大堆排序

     题目 最大堆排序 解决代码及点评 #include <stdio.h> #include <stdlib.h> #include <malloc.h> #i ...

  2. 初探 FFT/DFT

    有用的学习链接&书籍 傅立叶变化-维基百科 离散傅立叶变化-维基百科·长整数与多项式乘法 维基百科看英文的更多内容&有趣的图 快速傅立叶变化-百度百科,注意其中的图! 组合数学(第4版 ...

  3. mp3播放器

    1.视图 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:too ...

  4. Route@书写规则的总结

    路由书写规则的总结 概念:Routing System由一组路由组成,每一个路由规则可以匹配一种类型的URL,在请求过来的时候,Ruting ystem 就用它来处理这个URL,路由的任务就是匹配UR ...

  5. log4net使用流程

    前面大致介绍了一下log4net的概述和结构.既然都清楚了,下面我来介绍一下如何使用log4net. 使用流程 1.这里所说的使用流程就是使用log4net.dll,首先要根据你的平台来找出对应的版本 ...

  6. [Java聊天室server]实战之二 监听类

    前言 学习不论什么一个稍有难度的技术,要对其有充分理性的分析,之后果断做出决定---->也就是人们常说的"多谋善断":本系列尽管涉及的是socket相关的知识,但学习之前,更 ...

  7. Swift - 访问通讯录联系人(使用系统提供的通讯录交互界面)

    1,通讯录访问介绍 通讯录(或叫地址簿,电话簿)是一个数据库,里面储存了联系人的相关信息.要实现访问通讯录有如下两种方式: (1)AddressBook.framework框架 : 没有界面,通过代码 ...

  8. 如何删除JAVA集合中的元素

    经常我们要删除集合中的某些元素.有些可能会这么写. public void operate(List list){ for (Iterator it = list.iterator(); it.has ...

  9. android录音功能的实现

    这个录音实现是我在Bus上看到并下载的,他那个源码不完整,再次把我整理完整的代码贴出,源码地址在这:http://download.csdn.net/detail/chaozhung/5618649 ...

  10. Qt递归拷贝和删除目录

    最近在翻看项目代码时,看到了这两个函数,想到这个功能十分常用,因此拿出来与大家分享,希望对大家有用.几点说明: 1.记得当初写代码那会,是参考了网上的帖子写的,做了一点小修改.因此代码源于网络. 2. ...