title: when write of OutputStream write bytes(internally), then why read of InputStream returns int?
body: <p><strong>MyWriter.java</strong> (execute this before MyReader.java)</p>
  
  <pre><code>import java.io.*;
  import java.net.*;
  import java.util.* ;
  
  public class MyWriter {
  
      public static void main(String[] args) throws Exception {
  
          ServerSocket ss = new ServerSocket(1234) ;
          System.out.println("Server started...\n\n") ;
          Socket s = ss.accept() ;
  
          OutputStream out = s.getOutputStream() ;
  
          Scanner scan = new Scanner(System.in) ;
  
          while(true){
              System.out.print("Enter integer (or something else to quit) : ");
  
              try{
                  int i = scan.nextInt() ;
                  out.write(i) ;
              }catch(RuntimeException rte){
                  System.out.println("\n\n") ;
                  rte.printStackTrace() ;
                  System.out.println("\n\n") ;
                  break ;
              }
          }
      }
  }
  </code></pre>
  
  <p><strong>MyReader.java</strong> (only executed, when done with MyWriter.java)</p>
  
  <pre><code>import java.io.*;
  import java.net.*;
  import java.util.* ;
  
  public class MyReader {
  
      public static void main(String[] args) throws Exception {
  
          Socket s = new Socket("localhost", 1234) ;
  
          InputStream is = s.getInputStream() ;
  
          int i ;
          while( (i = is.read()) != -1 ){
              System.out.println( "character form : " + (char)i + ", int form : " + i);
          }
      }
  }
  </code></pre>
  
  <p><strong><em>Problem : MyReader is not getting terminated, even if I am passing -1 in MyWriter.</em></strong></p>