title: elegant way to read large data with FilterInputStream object
body: <p>I am getting a <code>FilterInputStream</code> object as a return type from a function. Now the file which I will be getting as an stream is a log file. So I think it can be big file. So I do not want to read the data all at once. But reading data in a loop is kind of tedious job.</p>
  
  <p>I need splitting at every newline, meaning data in file is in line separated format. With a constant size byte array to be used in <code>public int read(byte[], int off, int len)</code> as it will give rise to many cases. I do not want to read it at once because it can be of large size.</p>
  
  <p>Is there an elegant way to do this.</p>
  
  <p>P.S.: I am in particularly referring to <a href="http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/model/S3ObjectInputStream.html" rel="nofollow">S3ObjectInputStream</a> extended from <code>FilterInputStream</code> which has <code>read()</code> function.</p>