Class CsvUtil

java.lang.Object
org.bgerp.plugin.inventory.sync1c.service.CsvUtil

public class CsvUtil extends Object
Minimal RFC4180 CSV reader/writer for the sync1c File protocol — no CSV library is otherwise used in this project, so a dedicated dependency isn't warranted for two simple flat formats. Reads/writes UTF-8, and prepends a BOM on write so Excel opens Cyrillic text correctly.
  • Method Details

    • parse

      public static List<String[]> parse(InputStream in) throws IOException
      Parses a CSV stream into rows of raw string cells (no header interpretation here — callers that expect a header row should treat the first returned row specially). Handles quoted fields, embedded commas/newlines, and doubled-quote escaping. Strips a leading UTF-8 BOM if present.
      Throws:
      IOException
    • write

      public static void write(OutputStream out, List<String[]> rows) throws IOException
      Writes rows as CSV, quoting fields that contain a comma/quote/newline. Prepends a UTF-8 BOM.
      Throws:
      IOException