MCPcopy Create free account
hub / github.com/core-lib/xjar / readln

Method readln

src/main/java/io/xjar/XKit.java:33–52  ·  view source on GitHub ↗

从输入流中读取一行字节码 @param in 输入流 @return 最前面的一行字节码 @throws IOException I/O 异常

(InputStream in)

Source from the content-addressed store, hash-verified

31 * @throws IOException I/O 异常
32 */
33 public static byte[] readln(InputStream in) throws IOException {
34 int b = in.read();
35 if (b == -1) {
36 return null;
37 }
38 ByteArrayOutputStream bos = new ByteArrayOutputStream();
39 while (b != -1) {
40 switch (b) {
41 case '\r':
42 break;
43 case '\n':
44 return bos.toByteArray();
45 default:
46 bos.write(b);
47 break;
48 }
49 b = in.read();
50 }
51 return bos.toByteArray();
52 }
53
54 /**
55 * 往输出流中写入一行字节码

Callers

nothing calls this directly

Calls 2

readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected