An utility to usage efficience ByteArray in Kotlin and Java.

Overview

ByteArrayPool

An utility to usage efficience ByteArray in Kotlin and Java.

Usage

Create byte[] from pool

// Create byte[] with size = 16KB.
val byte16k = ByteArrayPool.getInstance().get(16 * 1024)
byte16k.use {
    // Do something with 16KB.
}

RecyclingBufferedInputStream

// Do something on sink of stream. return@stream true } } ">
// Use as input stream
val inputStream = FileInputStream("./something.txt").recyclingStream()
inputStream.recycling { // auto recycle
    it.stream { data, read, allRead ->
        // Do something on sink of stream.
        return@stream true
    }
}

RecyclingBufferedOutputStream

// Similar with input stream
val outputStream = RecyclingBufferedOutputStream(
    ByteArrayOutputStream()
)

outputStream.use { // auto recycle and close
    // Do something with stream
}

outputStream.recycling { // auto recycle
    // Do something with stream
}

Dependency

Maven

<dependency>
  <groupId>org.cuongnv.bytearraypoolgroupId>
  <artifactId>bytearraypoolartifactId>
  <version>0.0.1version>
dependency>

Gradle Kotlin DSL

implementation("org.cuongnv.bytearraypool:bytearraypool:0.0.1")

Gradle Groovy

implementation 'org.cuongnv.bytearraypool:bytearraypool:0.0.1'

License

Copyright 2021 Cuong V. Nguyen (github.com/cuongnv126).

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You might also like...

Fork of JProcesses with additional features and enhancements. Get cross-platform process details in Java.

Fork of JProcesses with additional features and enhancements. Get cross-platform process details in Java. Add this as dependency to your project via Maven/Gradle/Sbt/Leinigen (requires Java 7 or higher).

Mar 17, 2022

Java lib for monitoring directories or individual files via java.nio.file.WatchService

ch.vorburger.fswatch Java lib for monitoring directories or individual files based on the java.nio.file.WatchService. Usage Get it from Maven Central

Jan 7, 2022

Tencent Kona JDK11 is a no-cost, production-ready distribution of the Open Java Development Kit (OpenJDK), Long-Term Support(LTS) with quarterly updates. Tencent Kona JDK11 is certified as compatible with the Java SE standard.

Tencent Kona JDK11 is a no-cost, production-ready distribution of the Open Java Development Kit (OpenJDK), Long-Term Support(LTS) with quarterly updates. Tencent Kona JDK11 is certified as compatible with the Java SE standard.

Tencent Kona JDK11 Tencent Kona JDK11 is a no-cost, production-ready distribution of the Open Java Development Kit (OpenJDK), Long-Term Support(LTS) w

Dec 16, 2022

This repository contains Java programs to become zero to hero in Java.

This repository contains Java programs to become zero to hero in Java. Data Structure programs topic wise are also present to learn data structure problem solving in Java. Programs related to each and every concep are present from easy to intermidiate level

Oct 9, 2022

Preparation and practice for coding interviews

Coding Interviews Preparation and practice for coding interviews Hope you enjoy and help is more than welcome :) Problems by Dificulty A1 1D problems,

Oct 25, 2022

Client for anarchy servers that has bots / auto-modules and other stuff.

AutoBot is a module styled client for anarchy servers that offers bots and auto-modules like ElytraBot which is a pathfinding bot for elytras

Dec 27, 2022

JMusic bot fork with new features and fixes

JMusic bot fork with new features and fixes

JMusicBot-Fork (by d1m0s23) A cross-platform Discord music bot with a clean interface, and that is easy to set up and run yourself! 📋 SetupPage Fork

Nov 18, 2022

A full-fledged DSA marathon from 0 to 100. An initiative by GFG IIST Chapter and CodeChef IIST Chapter.

A full-fledged DSA marathon from 0 to 100. An initiative by GFG IIST Chapter and CodeChef IIST Chapter.

Full fledged DSA Marathon from Zero to Hundred. Enhance Your Data Structure and Algorithm knowledge with us. A Collaboration Event Series by GFG IIST

Nov 4, 2022

An open-source Java library for Constraint Programming

Documentation, Support and Issues Contributing Download and installation Choco-solver is an open-source Java library for Constraint Programming. Curre

Jan 3, 2023
Releases(v0.0.1)
Owner
Cuong V. Nguyen
Cuong V. Nguyen
Discord4J is a fast, powerful, unopinionated, reactive library to enable quick and easy development of Discord bots for Java, Kotlin, and other JVM languages using the official Discord Bot API.

Discord4J is a fast, powerful, unopinionated, reactive library to enable quick and easy development of Discord bots for Java, Kotlin, and other JVM languages using the official Discord Bot API.

null 1.5k Jan 4, 2023
jetbrick utility classes

jetbrick-commons This is an utility classes project for jetbrick framework. Documentation http://subchen.github.io/ Dependencies <dependency> <gro

Guoqiang Chen 20 Nov 15, 2022
BFS utility

How to use Example (Usage for https://www.codingame.com/contests/spring-challenge-2021 usage) gameContext.getAllTree().stream().forEach(tree ->

Guillaume Rousseau 3 May 10, 2021
Simple, declarative mail utility for sending mails with default smtp server or with custom channels.

Introduction email-util is simple, declarative utility library. Key features are: declarative email building; text or html rendering; annotation suppo

Nijat Asgarzada 3 Oct 12, 2021
A utility for guessing the CCSID of files (based on file contents)

CcsidGuesser A utility for guessing the CCSID of files (based on file contents). It can also fix CCSID tags and/or convert files to UTF-8! Usage Usage

Jesse Gorzinski 4 Feb 21, 2022
A tool ot export, analyse and visualize your transactions, rewards and commissions of your liquidity mining pools or DEX transactions

A tool ot export, analyse and visualize your transactions, rewards and commissions of your liquidity mining pools or DEX transactions.

Adam·Michael 15 Mar 11, 2022
Java Constraint Solver to solve vehicle routing, employee rostering, task assignment, conference scheduling and other planning problems.

OptaPlanner www.optaplanner.org Looking for Quickstarts? OptaPlanner’s quickstarts have moved to optaplanner-quickstarts repository. Quick development

KIE (Drools, OptaPlanner and jBPM) 2.8k Jan 2, 2023
Object-Oriented Java primitives, as an alternative to Google Guava and Apache Commons

Project architect: @victornoel ATTENTION: We're still in a very early alpha version, the API may and will change frequently. Please, use it at your ow

Yegor Bugayenko 691 Dec 27, 2022
Dex : The Data Explorer -- A data visualization tool written in Java/Groovy/JavaFX capable of powerful ETL and publishing web visualizations.

Dex Dex : The data explorer is a powerful tool for data science. It is written in Groovy and Java on top of JavaFX and offers the ability to: Read in

Patrick Martin 1.3k Jan 8, 2023
Java Collections till the last breadcrumb of memory and performance

Koloboke A family of projects around collections in Java (so far). The Koloboke Collections API A carefully designed extension of the Java Collections

Roman Leventov 967 Nov 14, 2022