annotate src/goodjava/io/DataInputStream.java @ 1591:85cd316f0cdb

remove javax.mail
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 18 Mar 2021 23:36:15 -0600
parents aaac1d29edea
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1492
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 package goodjava.io;
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 import java.io.InputStream;
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 import java.io.IOException;
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 import java.nio.charset.StandardCharsets;
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 public class DataInputStream extends java.io.DataInputStream {
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 public DataInputStream(InputStream in) {
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 super(in);
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 }
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 public String readString() throws IOException {
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 int len = readInt();
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 byte[] a = new byte[len];
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 readFully(a);
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 return new String(a,StandardCharsets.UTF_8);
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 }
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 }