DiskLib is an easy-to-use zero dependency Disk Writer & Disk Reader with built-in GZIP support for Java.
- Java Runtime 1.8 or higher
Add it as a maven dependency or just download the latest release.
<dependency>
<groupId>com.konloch</groupId>
<artifactId>DiskLib</artifactId>
<version>1.2.0</version>
</dependency>
You can pass either a String path or a File object for the first parameter. To use the GZIP functionality, use GZIPDiskReader or GZIPDiskWriter
View the test file here, it has examples of each function being used.
ArrayList<String> lines = DiskReader.read("hello.txt");
String[] lines = DiskReader.readLines("hello.txt");
byte[] bytes = DiskReader.readBytes("hello.txt");
- You can write / append
Lists
, orSets
, just pass where the string parameter goes for the content line.
DiskReader.write("hello.txt", "Hello ");
DiskReader.append("hello.txt", "World");