Skip to content

Latest commit

 

History

History
56 lines (44 loc) · 1.57 KB

README.md

File metadata and controls

56 lines (44 loc) · 1.57 KB

DiskLib

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.

<dependency>
  <groupId>com.konloch</groupId>
  <artifactId>DiskLib</artifactId>
  <version>1.2.0</version>
</dependency>

📚 Links

💻 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 = DiskReader.read("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");