Java Properties如何高效处理长尾词查询?
- 内容介绍
- 文章标签
- 相关推荐
本文共计417个文字,预计阅读时间需要2分钟。
Java Properties 文件操作,将一个配置文件加载到Properties中,使用load(输入字节流或输入字符流)方法。配置文件需要注意的细节:配置文件的注释必须是必要的。
java Properties/**
Properties 配置文件,
把一个配置文件加载到Properties中,load(输入字节流或者输入字符流)
配置文件需要注意的细节
配置文件的注释必须是#开头
配置文件中可以以一个等号或者空格作为键值的分割符。
Properties文件默认使用的编码是iso8859-1,如果想指定编码,需要使用字符流。
*/
import java.io.*;
import java.util.Properties;
public class PropertiesDemo{
public static void main(String[] args){
PropertiesDemo demo = new PropertiesDemo();
demo.readProperties();
}
//读取配置文件,以字节流的方式load()
public void readProperties() throws Exception{
//找到目标文件
File file = new file("D:\\demo.properties");
FileInputStream input = new FileInputStream(file);
//创建一个配置文件类对象
Properties properties = new Properties();
//把配置文件加载到properties中
properties.load(input);
//遍历
Set
本文共计417个文字,预计阅读时间需要2分钟。
Java Properties 文件操作,将一个配置文件加载到Properties中,使用load(输入字节流或输入字符流)方法。配置文件需要注意的细节:配置文件的注释必须是必要的。
java Properties/**
Properties 配置文件,
把一个配置文件加载到Properties中,load(输入字节流或者输入字符流)
配置文件需要注意的细节
配置文件的注释必须是#开头
配置文件中可以以一个等号或者空格作为键值的分割符。
Properties文件默认使用的编码是iso8859-1,如果想指定编码,需要使用字符流。
*/
import java.io.*;
import java.util.Properties;
public class PropertiesDemo{
public static void main(String[] args){
PropertiesDemo demo = new PropertiesDemo();
demo.readProperties();
}
//读取配置文件,以字节流的方式load()
public void readProperties() throws Exception{
//找到目标文件
File file = new file("D:\\demo.properties");
FileInputStream input = new FileInputStream(file);
//创建一个配置文件类对象
Properties properties = new Properties();
//把配置文件加载到properties中
properties.load(input);
//遍历
Set

