try (BufferedReader br = NippyFile.of(csvPath).asReader(StandardCharsets.UTF_8)) br.lines() .skip(1) // skip header .map(line -> line.split(",")) // simple CSV split .filter(cols -> cols.length > 5) .forEach(cols -> process(cols));
Below is a quick‑reference cheat sheet. All methods return NippyFile (or a primitive/collection) to enable fluent chaining.
| Library / Method | Write (ms) | Read (ms) | Memory (MiB) | |------------------|------------|-----------|--------------| | java.nio.file.Files.write | 94 | 71 | 120 | | NippyFile.writeAllBytes | | 48 | 78 | | NippyFile.writeAllBytesAsync (4‑thread pool) | 38 | 33 | 85 | | Apache Commons IO.FileUtils | 107 | 85 | 130 | | Guava Files.asByteSink | 96 | 73 | 115 | nippyfile j
// 1️⃣ Register codec (do this once at app start) NippyFile.registerCodec(new AesGcmCodec("my-super-secret-key"));
| Category | Feature | Short Description | |----------|---------|-------------------| | | readAllBytes() , writeAllBytes() | One‑liner read/write of whole files. | | | readLines() , writeLines() | Stream‑friendly line handling (UTF‑8, custom charset). | | | copyTo(Path target) , moveTo(Path target) | Atomic copy/move with optional overwrite modes. | | | transferTo(OutputStream) | Zero‑copy transfer for large binary blobs. | | Streaming | asInputStream() , asOutputStream() | Lazy, buffered streams that auto‑close. | | | asReader(Charset) , asWriter(Charset) | Character‑stream support. | | Compression | zipTo(Path zipFile) , unzipTo(Path dir) | One‑line ZIP creation/extraction (supports password‑less ZIP only). | | Temp Files | asTempFile(prefix, suffix) | Auto‑deleted temporary file with try‑with‑resources. | | Safety | readOnly() , writeOnly() | Explicitly restrict access mode. | | Async | readAllBytesAsync() , writeAllBytesAsync() | CompletableFuture‑based non‑blocking IO (Java 8+). | | Metrics | size() , lastModified() , isHidden() | Quick meta‑data access. | | Validation | exists() , ensureParentExists() | Guard clauses that throw NippyFileException . | | Extensibility | registerCustomCodec(Codec) | Plug in your own compression or serialization format. | try (BufferedReader br = NippyFile
While highly efficient for small-scale sharing, Nippyfile faces specific challenges:
List<CompletableFuture<NippyFile>> futures = new ArrayList<>(); for (int i = 0; i < payloads.size(); i++) Path target = Paths.get("build/batch/batch-" + i + ".bin"); futures.add(NippyFile.of(target) .writeAllBytesAsync(payloads.get(i)) .thenApplyAsync(f -> f.ensureParentExists(), pool)); | | | readLines() , writeLines() | Stream‑friendly
Seamlessly sync files across Windows, macOS, Linux, and mobile devices with delta‑sync technology that reduces bandwidth usage by up to 70%.
: It is generally not a "zero-knowledge" provider, meaning the service holds the decryption keys, unlike competitors such as pCloud or Tresorit.