Skip to content

Commit 5119cfd

Browse files
committed
Add Tran Class
1 parent c7d4039 commit 5119cfd

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/main/java/translate/Trans.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
}

0 commit comments

Comments
 (0)