PasteSite.Com

Recent Pastes

Sign Up!

PasteSite is open to the public, but with limited features. Register to be able to modify access rights, track your pastes and more...

Change the theme

If you prefer reading light text on a dark background to dark text on a light background, then you might want to try the dark theme.

This paste is a reply. View the Previous Paste?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.pie.jotta.io;
 
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.Socket;
 
public class InThread implements Runnable {
 
    private BufferedReader in;
    private Socket s;
    
    public InThread(Socket s) {
    this.s = s;
    try {
        in = new BufferedReader(new InputStreamReader(s.getInputStream()));
    } catch(IOException ioe) {
        ioe.printStackTrace();
    }
    }
    
    public String read() {
    String read = null;
        try {
        read = in.readLine();
    } catch(IOException ioe) {
            ioe.printStackTrace();
    }
    return read;
    }
    
    public void run() {
    String msg = null;
        while((msg = read()) != null) {
            System.out.println(msg);
    }
    }
}

Reply to This Paste

(leave blank to make this paste permanent)
(if set as private)