transfer byte array instead of char[]

This commit is contained in:
hns 2001-02-27 20:54:06 +00:00
parent e9e9f81722
commit f6b2001fb4

View file

@ -17,7 +17,7 @@ public class ResponseTrans implements Serializable {
public String contentType = "text/html"; public String contentType = "text/html";
// the actual response // the actual response
private char[] response = null; private byte[] response = null;
// contains the redirect URL // contains the redirect URL
public String redirect = null; public String redirect = null;
@ -147,10 +147,10 @@ public class ResponseTrans implements Serializable {
*/ */
public synchronized void close () { public synchronized void close () {
if (buffer != null) { if (buffer != null) {
response = new String (buffer).toCharArray(); response = buffer.toString ().getBytes ();
buffer = null; // make sure this is done only once, even with more requsts attached buffer = null; // make sure this is done only once, even with more requsts attached
} else { } else {
response = new char[0]; response = new byte[0];
} }
notifyAll (); notifyAll ();
} }
@ -166,8 +166,8 @@ public class ResponseTrans implements Serializable {
} catch (InterruptedException ix) {} } catch (InterruptedException ix) {}
} }
public String getContentString () { public byte[] getContent () {
return response == null ? "" : new String (response); return response == null ? new byte[0] : response;
} }
public int getContentLength () { public int getContentLength () {