annotate src/goodjava/io/DataOutputStream.java @ 1614:557bb90b70d7

fix BasicAuthHandler bug
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 25 May 2021 13:21:31 -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.OutputStream;
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 DataOutputStream extends java.io.DataOutputStream {
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 DataOutputStream(OutputStream out) {
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 super(out);
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 void writeString(String s) throws IOException {
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 byte[] a = s.getBytes(StandardCharsets.UTF_8);
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 writeInt(a.length);
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 write(a);
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 }
aaac1d29edea better io
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 }