comparison src/goodjava/io/IoUtils.java @ 2008:bba3e529e346 default tip

chunked encoding
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 27 Aug 2025 01:14:17 -0600
parents ad312de2a30e
children
comparison
equal deleted inserted replaced
2007:408f7dd7e503 2008:bba3e529e346
79 } 79 }
80 80
81 public static void copyAll(InputStream in,OutputStream out) 81 public static void copyAll(InputStream in,OutputStream out)
82 throws IOException 82 throws IOException
83 { 83 {
84 byte[] a = new byte[8192]; 84 byte[] a = new byte[32768];
85 int n; 85 int n;
86 while( (n=in.read(a)) != -1 ) { 86 while( (n=in.read(a)) != -1 ) {
87 out.write(a,0,n); 87 out.write(a,0,n);
88 } 88 }
89 in.close(); 89 in.close();
90 } 90 }
91 91
92 public static void copyAll(Reader in,Writer out) 92 public static void copyAll(Reader in,Writer out)
93 throws IOException 93 throws IOException
94 { 94 {
95 char[] a = new char[8192]; 95 char[] a = new char[32768];
96 int n; 96 int n;
97 while( (n=in.read(a)) != -1 ) { 97 while( (n=in.read(a)) != -1 ) {
98 out.write(a,0,n); 98 out.write(a,0,n);
99 } 99 }
100 in.close(); 100 in.close();