|
|
|
|
@ -0,0 +1,32 @@
|
|
|
|
|
// 定义一个简单的Java类,用于演示如何读取小米便签中的数据。
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
|
import java.util.Properties;
|
|
|
|
|
|
|
|
|
|
public class MiNoteReader {
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
try {
|
|
|
|
|
// 假设便签数据存储在一个名为notes.properties的文件中
|
|
|
|
|
File propertiesFile = new File("notes.properties");
|
|
|
|
|
FileInputStream fis = new FileInputStream(propertiesFile);
|
|
|
|
|
Properties properties = new Properties();
|
|
|
|
|
|
|
|
|
|
// 加载文件内容到Properties对象中
|
|
|
|
|
properties.load(fis);
|
|
|
|
|
|
|
|
|
|
// 读取属性
|
|
|
|
|
String note1 = properties.getProperty("note1");
|
|
|
|
|
String note2 = properties.getProperty("note2");
|
|
|
|
|
|
|
|
|
|
// 打印便签内容
|
|
|
|
|
System.out.println("第一条便签记录: " + note1);
|
|
|
|
|
System.out.println("第二条便签记录: " + note2);
|
|
|
|
|
|
|
|
|
|
// 关闭文件输入流
|
|
|
|
|
fis.close();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|