public class Object2FileUtils extends Object
限定符和类型 | 方法和说明 |
---|---|
static JSONArray |
readFile2JSONArray(File jsonFile)
读取文件到json对象
|
static JSONObject |
readFile2JSONObject(File jsonFile)
读取文件到json对象
|
static Serializable |
readObject(File file)
从文件读取对象
|
static Serializable |
readObject(InputStream is)
从输入流读取对象
|
static String |
readString(InputStream is)
读取输入流到String
|
static void |
writeJSONArray2File(JSONArray jsonArray,
String objPath)
写入json对象到文件
|
static void |
writeJSONObject2File(JSONObject jsonObject,
String objPath)
写入json对象到文件
|
static void |
writeObject(Serializable obj,
OutputStream out)
将object对象写入输出流
|
static void |
writeObject(Serializable obj,
String objPath)
将对象写入文件
|
static void |
writeString2File(String str,
OutputStream os)
写入String到输出流
|
public static void writeJSONObject2File(JSONObject jsonObject, String objPath)
jsonObject
- objPath
- public static void writeJSONArray2File(JSONArray jsonArray, String objPath)
jsonArray
- objPath
- public static JSONArray readFile2JSONArray(File jsonFile)
jsonFile
- public static JSONObject readFile2JSONObject(File jsonFile)
jsonFile
- public static void writeString2File(String str, OutputStream os)
str
- os
- public static String readString(InputStream is)
is
- public static void writeObject(Serializable obj, OutputStream out)
obj
- out
- public static Serializable readObject(InputStream is)
is
- public static void writeObject(Serializable obj, String objPath)
obj
- objPath
- public static Serializable readObject(File file)
file
-