1 /**********************************************************************
2 * Copyright (c) 2003 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM - Initial API and implementation
10 **********************************************************************/
11 package net.sourceforge.phpdt.monitor.core.internal;
15 * Monitor server I/O thread.
17 public class DefaultThread extends Thread {
18 private static final int BUFFER = 2048;
19 protected InputStream in;
20 protected OutputStream out;
21 protected boolean isRequest;
23 protected Connection conn;
24 protected Request request;
27 * MonitorThread constructor comment.
29 public DefaultThread(Connection conn, Request request, InputStream in, OutputStream out, boolean isRequest) {
32 this.request = request;
35 this.isRequest = isRequest;
36 setPriority(Thread.NORM_PRIORITY + 1);
41 * Listen for input, save it, and pass to the output stream.
45 byte[] b = new byte[BUFFER];
49 if (b != null && n > 0) {
55 System.arraycopy(b, 0, x, 0, n);
58 request.addToRequest(x);
60 request.addToResponse(x);
66 } catch (IOException e) {
68 request.fireChangedEvent();