Class CsvFileRecordsImpl<T>

    • Constructor Detail

      • CsvFileRecordsImpl

        public CsvFileRecordsImpl​(Header<T> aHeader,
                                  java.io.File aCsvFile)
                           throws java.io.FileNotFoundException,
                                  java.io.IOException,
                                  java.util.zip.ZipException
        Constructs a CsvFileRecordsImpl with the given parameters. Internally Column instances are generated according to the keys found in the CSV top line. The Column instances are required to convert the CSV line values. If a Header is provided, then the Header is used for generating the Column instances instead of the top line of the CSV file.
        Parameters:
        aHeader - The Header to use when parsing the lines retrieved from the InputStream.
        aCsvFile - The CSV File which to parse.
        Throws:
        java.io.FileNotFoundException - the file not found exception
        java.io.IOException - in case there were problems working with the given File.
        java.util.zip.ZipException - the zip exception
      • CsvFileRecordsImpl

        public CsvFileRecordsImpl​(Header<T> aHeader,
                                  java.io.File aCsvFile,
                                  char aCsvSeparator)
                           throws java.io.FileNotFoundException,
                                  java.io.IOException,
                                  java.util.zip.ZipException
        Constructs a CsvFileRecordsImpl with the given parameters. Internally Column instances are generated according to the keys found in the CSV top line. The Column instances are required to convert the CSV line values. If a Header is provided, then the Header is used for generating the Column instances instead of the top line of the CSV file.
        Parameters:
        aHeader - The Header to use when parsing the lines retrieved from the InputStream.
        aCsvFile - The CSV File which to parse.
        aCsvSeparator - The delimiter being expected for the CSV input stream.
        Throws:
        java.io.FileNotFoundException - the file not found exception
        java.io.IOException - in case there were problems working with the given File.
        java.util.zip.ZipException - the zip exception
      • CsvFileRecordsImpl

        public CsvFileRecordsImpl​(Header<T> aHeader,
                                  java.io.File aCsvFile,
                                  boolean isStrict)
                           throws java.io.FileNotFoundException,
                                  java.io.IOException,
                                  java.util.zip.ZipException
        Constructs a CsvFileRecordsImpl with the given parameters. Internally Column instances are generated according to the keys found in the CSV top line. The Column instances are required to convert the CSV line values. If a Header is provided, then the Header is used for generating the Column instances instead of the top line of the CSV file.
        Parameters:
        aHeader - The Header to use when parsing the lines retrieved from the InputStream.
        aCsvFile - The CSV File which to parse.
        isStrict - When true, then parsing will abort with an exception in case of parsing problems, else parsing is gracefully continued and erroneous records are skipped. The error count CsvInputStreamRecordsImpl.getErroneousRecordCount() is incremented by each erroneous Record.
        Throws:
        java.io.FileNotFoundException - the file not found exception
        java.io.IOException - in case there were problems working with the given File.
        java.util.zip.ZipException - the zip exception
      • CsvFileRecordsImpl

        public CsvFileRecordsImpl​(Header<T> aHeader,
                                  java.io.File aCsvFile,
                                  char aCsvSeparator,
                                  boolean isStrict)
                           throws java.io.FileNotFoundException,
                                  java.io.IOException,
                                  java.util.zip.ZipException
        Constructs a CsvFileRecordsImpl with the given parameters. Internally Column instances are generated according to the keys found in the CSV top line. The Column instances are required to convert the CSV line values. If a Header is provided, then the Header is used for generating the Column instances instead of the top line of the CSV file.
        Parameters:
        aHeader - The Header to use when parsing the lines retrieved from the InputStream.
        aCsvFile - The CSV File which to parse.
        aCsvSeparator - The delimiter being expected for the CSV input stream.
        isStrict - When true, then parsing will abort with an exception in case of parsing problems, else parsing is gracefully continued and erroneous records are skipped. The error count CsvInputStreamRecordsImpl.getErroneousRecordCount() is incremented by each erroneous Record.
        Throws:
        java.io.FileNotFoundException - the file not found exception
        java.io.IOException - in case there were problems working with the given File.
        java.util.zip.ZipException - the zip exception
      • CsvFileRecordsImpl

        public CsvFileRecordsImpl​(ColumnFactory<T> aColumnFactory,
                                  java.io.File aCsvFile)
                           throws java.io.FileNotFoundException,
                                  java.io.IOException,
                                  java.util.zip.ZipException
        Constructs a CsvFileRecordsImpl with the given parameters. This constructor supports a ColumnFactory for creating Column instance according to the keys found in the CSV top line. The Column instances are required to convert the CSV line values from the storage format to the actual required type.
        Parameters:
        aColumnFactory - A ColumnFactory to be used to generate Column instances from the top line of the CSF file, required for parsing the CSV lines and converting them to Record instances.
        aCsvFile - The CSV File which to parse.
        Throws:
        java.io.FileNotFoundException - the file not found exception
        java.io.IOException - in case there were problems working with the given File.
        java.util.zip.ZipException - the zip exception
      • CsvFileRecordsImpl

        public CsvFileRecordsImpl​(ColumnFactory<T> aColumnFactory,
                                  java.io.File aCsvFile,
                                  char aCsvSeparator)
                           throws java.io.FileNotFoundException,
                                  java.io.IOException,
                                  java.util.zip.ZipException
        Constructs a CsvFileRecordsImpl with the given parameters. This constructor supports a ColumnFactory for creating Column instance according to the keys found in the CSV top line. The Column instances are required to convert the CSV line values from the storage format to the actual required type.
        Parameters:
        aColumnFactory - A ColumnFactory to be used to generate Column instances from the top line of the CSF file, required for parsing the CSV lines and converting them to Record instances.
        aCsvFile - The CSV File which to parse.
        aCsvSeparator - The delimiter being expected for the CSV input stream.
        Throws:
        java.io.FileNotFoundException - the file not found exception
        java.io.IOException - in case there were problems working with the given File.
        java.util.zip.ZipException - the zip exception
      • CsvFileRecordsImpl

        public CsvFileRecordsImpl​(ColumnFactory<T> aColumnFactory,
                                  java.io.File aCsvFile,
                                  boolean isStrict)
                           throws java.io.FileNotFoundException,
                                  java.io.IOException,
                                  java.util.zip.ZipException
        Constructs a CsvFileRecordsImpl with the given parameters. This constructor supports a ColumnFactory for creating Column instance according to the keys found in the CSV top line. The Column instances are required to convert the CSV line values from the storage format to the actual required type.
        Parameters:
        aColumnFactory - A ColumnFactory to be used to generate Column instances from the top line of the CSF file, required for parsing the CSV lines and converting them to Record instances.
        aCsvFile - The CSV File which to parse.
        isStrict - When true, then parsing will abort with an exception in case of parsing problems, else parsing is gracefully continued and erroneous records are skipped. The error count CsvInputStreamRecordsImpl.getErroneousRecordCount() is incremented by each erroneous Record.
        Throws:
        java.io.FileNotFoundException - the file not found exception
        java.io.IOException - in case there were problems working with the given File.
        java.util.zip.ZipException - the zip exception
      • CsvFileRecordsImpl

        public CsvFileRecordsImpl​(ColumnFactory<T> aColumnFactory,
                                  java.io.File aCsvFile,
                                  char aCsvSeparator,
                                  boolean isStrict)
                           throws java.io.FileNotFoundException,
                                  java.io.IOException,
                                  java.util.zip.ZipException
        Constructs a CsvFileRecordsImpl with the given parameters. This constructor supports a ColumnFactory for creating Column instance according to the keys found in the CSV top line. The Column instances are required to convert the CSV line values from the storage format to the actual required type.
        Parameters:
        aColumnFactory - A ColumnFactory to be used to generate Column instances from the top line of the CSF file, required for parsing the CSV lines and converting them to Record instances.
        aCsvFile - The CSV File which to parse.
        aCsvSeparator - The delimiter being expected for the CSV input stream.
        isStrict - When true, then parsing will abort with an exception in case of parsing problems, else parsing is gracefully continued and erroneous records are skipped. The error count CsvInputStreamRecordsImpl.getErroneousRecordCount() is incremented by each erroneous Record.
        Throws:
        java.io.FileNotFoundException - the file not found exception
        java.io.IOException - in case there were problems working with the given File.
        java.util.zip.ZipException - the zip exception
    • Method Detail

      • toInputStream

        protected static java.io.InputStream toInputStream​(java.io.File aFile)
                                                    throws java.util.zip.ZipException,
                                                           java.io.IOException,
                                                           java.io.FileNotFoundException
        Returns an InputStream from the provided File. In case the file points to a ZIP compressed file, then the uncompressed data is provided by the InputStream.
        Parameters:
        aFile - The File for which to get the InputStream.
        Returns:
        An InputStream, in case of a ZIP compressed File, an uncompressed InputStream is returned.
        Throws:
        java.util.zip.ZipException - in case there were problems when accessing the ZIP compressed File.
        java.io.IOException - in case there were problems working with the File.
        java.io.FileNotFoundException - in case there was none such File found.
      • toFileNameFromZip

        protected static java.lang.String toFileNameFromZip​(java.lang.String aZipFileName)
        Truncates the ".zip" suffix from the filename and returns the result. For example a file with name "log-2023-07-12.txt.zip" results in "log-2023-07-12.txt".
        Parameters:
        aZipFileName - The file name of the ZIP file for which to get the "inner" file name.
        Returns:
        The "inner" file name if the file suffix was ".zip", else null.