org.ujmp.core.util.io
Class SeekableLineInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.ujmp.core.util.io.SeekableLineInputStream
All Implemented Interfaces:
Closeable

public class SeekableLineInputStream
extends InputStream

This stream searches all line end characters (hex 0A) in a file. For Linux line splitting is OK, for Windows the character hex 0D has to be eliminated with String.trim()


Constructor Summary
SeekableLineInputStream(File file)
           
SeekableLineInputStream(String file)
           
 
Method Summary
 void close()
           
 int getLineCount()
           
 int read()
           
 String readLine(int lineNumber)
           
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SeekableLineInputStream

public SeekableLineInputStream(String file)
                        throws IOException
Throws:
IOException

SeekableLineInputStream

public SeekableLineInputStream(File file)
                        throws IOException
Throws:
IOException
Method Detail

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException

getLineCount

public int getLineCount()

read

public int read()
         throws IOException
Specified by:
read in class InputStream
Throws:
IOException

readLine

public String readLine(int lineNumber)
                throws IOException
Throws:
IOException


Copyright © 2010. All Rights Reserved.