Skip to content

raghul-tech/OpenLoom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧡 OpenLoom

The intelligent file reader for Java β€” blazing fast, zero config, and async-ready.

πŸ” Read any file. 🧠 Choose the best method. πŸš€ Perform like a pro.

Maven Central Build Status CodeQL Security Javadoc Latest Release Buy Me A Coffee


✨ Why Use OpenLoom?

βœ… Zero Config – Just drop in and start reading files.
βœ… Adaptive Engine – Chooses the best reading method based on file size.
βœ… Built-in Async – Boost performance with CompletableFuture.
βœ… Stream-Friendly – Sync & async line streaming.
βœ… Charset Control – Easily switch encodings.
βœ… Lightweight – Minimal dependencies, fast and focused.


πŸš€ Features

  • πŸ“„ Read text files into memory (StringBuilder)
  • πŸ€– Automatically chooses efficient read strategy (Buffered, NIO, Mapped)
  • ⏱️ Read files asynchronously
  • πŸ“₯ Line-by-line streaming (sync & async)
  • 🌍 Support for multiple charsets (UTF-8, ISO-8859-1, UTF-16 etc.)
  • πŸ§ͺ Simple API ideal for logging, parsing, and file analysis

πŸ“¦ Installation

Maven

<dependency>
  <groupId>io.github.raghul-tech</groupId>
  <artifactId>openloom</artifactId>
  <version>0.0.2</version>
</dependency>

Gradle

implementation 'io.github.raghul-tech:openloom:0.0.2'

✍️ Usage Examples

πŸ”Ή Basic File Read

➑️ BasicReadExample.java

OpenLoom reader = new OpenLoom();
StringBuilder content = reader.read(new File("example.txt"));
System.out.println(content);

πŸ”Ή Read using Path

➑️ PathReadExample.java

StringBuilder content = reader.read(Paths.get("data/example.txt"));

πŸ”Ή Async Read

➑️ AsyncReadExample.java

reader.readAsync(new File("large.txt")).thenAccept(content -> {
    System.out.println("First 100 chars: " + content.substring(0, 100));
});

πŸ”Ή Stream Lines (Sync & Async)

➑️ StreamLineExample.java

reader.streamLines(new File("log.txt"), System.out::println);
reader.streamLinesAsync(Paths.get("errors.log"), line -> {
    if (line.contains("ERROR")) System.err.println("Error line: " + line);
});

πŸ”Ή Change Charset (Mid-execution)

➑️ CharsetExample.java

OpenLoom reader = new OpenLoom(StandardCharsets.ISO_8859_1);
StringBuilder content = reader.read(Paths.get("legacy.txt"));
reader.setCharset(StandardCharsets.UTF_16);

πŸ’‘ Run Using JAR

🧡 Compile:

javac -cp openloom-0.0.2.jar ReadExampleWithFile.java

▢️ Run:

Windows:

java -cp .;openloom-0.0.2.jar ReadExampleWithFile   

Linux/macOS:

java -cp .:openloom-0.0.2.jar ReadExampleWithFile   

🧩 Requirements

  • Java 8 or above (JDK 17+ recommended)

πŸ“‚ Example Files

βœ… Ready-to-run examples in the examples/ folder:


πŸ†• Changelog:


🀝 Contributing

  • We welcome PRs for:

    • πŸ› Bug fixes

    • πŸš€ New features

    • πŸ§ͺ More examples

    • πŸ“ Documentation

Read the Contributing Guide before starting..


🐞 Report a Bug

  • If you've encountered a bug, please report it by clicking the link below. This will guide you through the bug-reporting process: ➑️ Click here to report a bug

πŸ“„ License


πŸ“¬ Contact

Email: raghultech.app@gmail.com


β˜• Support

If OpenLoom helped you, you can support it here ❀️

Buy Me A Coffee