Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


DiskLib is an easy-to-use zero dependency Disk Writer & Disk Reader with built-in GZIP support for Java.

💡 Requirements

  • Java Runtime 1.8 or higher

⚙️ How To Add As Library

Add it as a maven dependency or just download the latest release.


💻 How To Use

You can pass either a String path or a File object for the first parameter. To use the GZIP functionality, use GZIPDiskReader or GZIPDiskWriter

For more examples

View the test file here, it has examples of each function being used.

⬆️ Reading

Reading Strings from disk

ArrayList<String> lines ="hello.txt");

Reading String Arrays from disk

String[] lines = DiskReader.readLines("hello.txt");

Reading Bytes from disk

byte[] bytes = DiskReader.readBytes("hello.txt");

⬇️ Writing

  • You can write / append Lists, or Sets, just pass where the string parameter goes for the content line.

Write new file to disk / overwrite existing file

DiskReader.write("hello.txt", "Hello ");

Append to existing file

DiskReader.append("hello.txt", "World");