File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change
1
+ package translate ;
2
+
3
+ import com .alibaba .fastjson .JSONObject ;
4
+
5
+ import java .io .FileNotFoundException ;
6
+ import java .io .IOException ;
7
+ import java .io .RandomAccessFile ;
8
+
9
+ public class Trans {
10
+ public Trans (String path ) throws IOException , FileNotFoundException {
11
+ RandomAccessFile rf = new RandomAccessFile (path , "r" );
12
+ StringBuilder content = new StringBuilder ();
13
+ while (rf .getFilePointer () < rf .length ()) {
14
+ content .append (rf .readLine ());
15
+ }
16
+ rf .close ();
17
+ JSONObject object = JSONObject .parseObject (content .toString ());
18
+ System .out .println (object );
19
+ }
20
+ public static void main (String [] args ) throws IOException , FileNotFoundException {
21
+ Trans trans = new Trans ("test.json" );
22
+ }
23
+ }
You can’t perform that action at this time.
0 commit comments