Skip to content

Releases: fixed-width-file/java-fwf

v1.0.0 - Initial Release

Choose a tag to compare

@kelsoncm kelsoncm released this 21 Jul 14:24

🚀 java-fwf v1.0.0 - Initial Release

We are excited to announce the first official release of java-fwf (v1.0.0)!

java-fwf is a high-performance, type-safe Java 17+ library for parsing, validating, hydrating, and exporting Fixed Width Files (FWF). It is part of the Fixed Width File Ecosystem and fully implements the fwf-compliance-tests v1.0.0 specification.


🌟 Key Features

  • ⚡ Type-Safe Column Definitions:

    • CharColumn: Left-aligned text columns with trailing space trimming.
    • RightCharColumn: Right-aligned text columns with leading space trimming.
    • PositiveIntegerColumn: Zero-padded integer values.
    • PositiveDecimalColumn: Fixed decimal places and scaling support.
    • DateColumn: Flexible date formatting (LocalDate).
    • TimeColumn: Time formatting (LocalTime).
    • DateTimeColumn: Date and time formatting (LocalDateTime).
  • 📜 Flexible Record Descriptors:

    • HeaderRowDescriptor: Define header record layouts.
    • DetailRowDescriptor: Define detail record layouts.
    • FooterRowDescriptor: Define footer record layouts.
    • FileDescriptor: Full file structure container with strict line size validation.
  • 🔍 Cross-Language Hydration (HydrateUtils):

    • Bidirectional serialization/deserialization between Java objects and JSON representations, fully compatible with Python pyfwf and PHP php-fwf.
  • 📖 Documentation & Output Renders (RenderUtils):

    • Export file descriptors directly to Markdown, ReStructuredText (RST), or HTML tables.
  • 🧪 Quality & Compliance:

    • 100% Compliance: Passes all 5 official test cases from fwf-compliance-tests v1.0.0.
    • JaCoCo Coverage: Verified with strict automated line and branch coverage gates.
    • JUnit 5 Suite: 29 automated unit tests covering all core components and edge cases.

📦 Dependency Setup

Apache Maven

<dependency>
    <groupId>com.kelsoncm.fwf</groupId>
    <artifactId>java-fwf</artifactId>
    <version>1.0.0</version>
</dependency>

Gradle (Groovy)

implementation 'com.kelsoncm.fwf:java-fwf:1.0.0'

💡 Quickstart Example

import com.kelsoncm.fwf.columns.*;
import com.kelsoncm.fwf.descriptors.*;
import com.kelsoncm.fwf.readers.Reader;
import java.util.List;
import java.util.Map;

public class Example {
    public static void main(String[] args) {
        // 1. Define columns
        CharColumn nameCol = new CharColumn("name", 20, "User Name");
        PositiveIntegerColumn ageCol = new PositiveIntegerColumn("age", 3, "Age in years");

        // 2. Define row and file descriptors
        DetailRowDescriptor detail = new DetailRowDescriptor(List.of(nameCol, ageCol));
        FileDescriptor fileDescriptor = new FileDescriptor(List.of(detail));

        // 3. Read fixed-width content
        String content = "KELSON MEDEIROS     045\nMARIA SILVA         030\n";
        Reader reader = new Reader(content, fileDescriptor, "\n");

        for (Map<String, Object> row : reader) {
             System.out.println("Name: " + row.get("name") + " | Age: " + row.get("age"));
        }
    }
}

👥 Contributors