Java OutputStream Write Text readLine(InputStream in, OutputStream out)

Here you can find the source of readLine(InputStream in, OutputStream out)

Description

read Line

License

Open Source License

Declaration

private static void readLine(InputStream in, OutputStream out) throws IOException 

Method Source Code

//package com.java2s;
/* Copyright (c) 2010, Avian Contributors
    //from  w ww.j a v  a 2 s .c om
   Permission to use, copy, modify, and/or distribute this software
   for any purpose with or without fee is hereby granted, provided
   that the above copyright notice and this permission notice appear
   in all copies.
    
   There is NO WARRANTY for this software.  See license.txt for
   details. */

import java.io.IOException;

import java.io.InputStream;
import java.io.OutputStream;

public class Main {
    private static void readLine(InputStream in, OutputStream out) throws IOException {
        while (true) {
            int c = in.read();
            switch (c) {
            case ' ':
            case '\r':
            case '\t':
                break;

            case '\n':
            case -1:
                return;

            default:
                out.write(c);
            }
        }
    }
}

Related

  1. readLine(InputStream in, OutputStream out)
  2. readLine(java.io.InputStream input)