Mercurial Hosting > luan
annotate src/goodjava/io/DataInputStream.java @ 2019:cbc5a66217d7
windows fix
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Fri, 03 Oct 2025 18:28:21 -0600 |
| parents | aaac1d29edea |
| children |
| rev | line source |
|---|---|
| 1492 | 1 package goodjava.io; |
| 2 | |
| 3 import java.io.InputStream; | |
| 4 import java.io.IOException; | |
| 5 import java.nio.charset.StandardCharsets; | |
| 6 | |
| 7 | |
| 8 public class DataInputStream extends java.io.DataInputStream { | |
| 9 | |
| 10 public DataInputStream(InputStream in) { | |
| 11 super(in); | |
| 12 } | |
| 13 | |
| 14 public String readString() throws IOException { | |
| 15 int len = readInt(); | |
| 16 byte[] a = new byte[len]; | |
| 17 readFully(a); | |
| 18 return new String(a,StandardCharsets.UTF_8); | |
| 19 } | |
| 20 } |
