Package de.willuhn.io

Class CSVFile


  • public class CSVFile
    extends java.lang.Object
    Parser fuer CSV-Dateien.
    • Constructor Summary

      Constructors 
      Constructor Description
      CSVFile​(java.io.InputStream file)
      ct.
      CSVFile​(java.io.InputStream file, java.lang.String separator)
      ct.
      CSVFile​(java.io.InputStream file, java.lang.String separator, java.lang.String encoding)
      ct.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Schliesst die CSV-Datei.
      boolean hasNext()
      Prueft, ob weitere Zeilen vorhanden sind.
      java.lang.String[] next()
      Liefert die naechste Zeile der Datei.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CSVFile

        public CSVFile​(java.io.InputStream file)
        ct.
        Parameters:
        file - die CSV-Datei.
      • CSVFile

        public CSVFile​(java.io.InputStream file,
                       java.lang.String separator)
        ct.
        Parameters:
        file - die CSV-Datei.
        separator - Trennzeichen.
      • CSVFile

        public CSVFile​(java.io.InputStream file,
                       java.lang.String separator,
                       java.lang.String encoding)
                throws java.io.UnsupportedEncodingException
        ct.
        Parameters:
        file - die CSV-Datei.
        separator - Trennzeichen.
        encoding - das Encoding.
        Throws:
        java.io.UnsupportedEncodingException
    • Method Detail

      • hasNext

        public boolean hasNext()
                        throws java.io.IOException
        Prueft, ob weitere Zeilen vorhanden sind. Der interne Pointer rueckt durch Aufruf dieser Funktion nicht weiter. Die Funktion kann also mehrmals hintereinander aufgerufen werden. Der Reader rueckt erst durch Aufruf der Funktion next() weiter.
        Returns:
        true, wenn noch Zeilen vorhanden sind, sonst false.
        Throws:
        java.io.IOException
      • next

        public java.lang.String[] next()
                                throws java.io.IOException
        Liefert die naechste Zeile der Datei.
        Returns:
        naechste Zeile.
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Schliesst die CSV-Datei.
        Throws:
        java.io.IOException