private final Socket s;
public final String vhost;
public Connection(Socket s, String vhost) { super(s); this.vhost = vhost; this.s = s; }
- public void close() { try{s.close();}catch(Exception e){throw new StreamException(e);} super.close(); }
+ public void close() { try{s.close();}catch(Exception e){throw new Stream.StreamException(e);} super.close(); }
public int getLocalPort() { return s.getLocalPort(); }
public InetAddress getLocalAddress() { return ((InetSocketAddress)s.getLocalSocketAddress()).getAddress(); }
public int getRemotePort() { return s.getPort(); }
public InetAddress getRemoteAddress() { return ((InetSocketAddress)s.getRemoteSocketAddress()).getAddress(); }
public String getRemoteHostname() { return getRemoteAddress().getHostName(); }
public String getVirtualHost() { return vhost; }
- public void setTimeout(int ms) { try { s.setSoTimeout(ms); } catch (Exception e){throw new StreamException(e); }}
- public void setTcpNoDelay(boolean delay) { try { s.setTcpNoDelay(delay);}catch(Exception e){throw new StreamException(e); }}
+ public void setTimeout(int ms) { try { s.setSoTimeout(ms); } catch (Exception e){throw new Stream.StreamException(e); }}
+ public void setTcpNoDelay(boolean delay) { try { s.setTcpNoDelay(delay);}catch(Exception e){throw new Stream.StreamException(e); }}
}
} finally { flushing = false; }
}
- Writer unreader = new OutputStreamWriter(new OutputStream() {
- public void close() { }
- public void write(int i) throws IOException { byte[] b = new byte[1]; b[0] = (byte)i; write(b, 0, 1); }
- public void write(byte[] b) throws IOException { write(b, 0, b.length); }
- public void write(byte[] b, int p, int l) {
- ensureb2(l);
- System.arraycopy(b, p, buf, start-l, l);
- start -= l;
- }
- });
+ Writer unreader = new OutputStreamWriter(new InOutputStream());
+ private class InOutputStream extends OutputStream {
+ public void close() { }
+ public void write(int i) throws IOException { byte[] b = new byte[1]; b[0] = (byte)i; write(b, 0, 1); }
+ public void write(byte[] b) throws IOException { write(b, 0, b.length); }
+ public void write(byte[] b, int p, int l) {
+ ensureb2(l);
+ System.arraycopy(b, p, buf, start-l, l);
+ start -= l;
+ }
+ }
}
}