GitXplorerGitXplorer
g

EasyByte

public
7 stars
0 forks
2 issues

Commits

List of commits on branch main.
Unverified
7055e232a344fe5455b21a8c7c02c3a4e4ba52bd

Merge branch 'publish-github'

ggongxuanzhang committed 9 months ago
Unverified
4318a9831ade62bb6dfe9ca9a3dcfae286224383

add api update version

ggongxuanzhang committed 9 months ago
Unverified
c2003298b29fbb27cabb529b88b53cd8447be65f

add api update version

ggongxuanzhang committed 9 months ago
Unverified
db3bdb62ee723bd59e55d71fa200c4a6a3b6c108

add api

ggongxuanzhang committed 9 months ago
Verified
1cd2ac43c441df5bf6959b67897260ebc92e5098

Update README.adoc

ggongxuanzhang committed 10 months ago
Unverified
bf1dc29765067af13ea55f2e65cdeeb1883d38e8

add api

ggongxuanzhang committed 10 months ago

README

The README file for this repository.

++++

GitHub Readme Stats

++++

image:https://img.shields.io/badge/java-8+-4c7e9f.svg[link="http://java.oracle.com"] image:https://img.shields.io/github/license/gongxuanzhang/EasyByte[link="http://www.apache.org/licenses/LICENSE-2.0.txt"] image:https://img.shields.io/maven-central/v/org.gongxuanzhang/easyByte["groupId"] image:https://img.shields.io/github/languages/code-size/gongxuanzhang/EasyByte[]

link:./README_zh.adoc[中文文档]

== What is EasyByte?

EasyByte is a ByteBuffer operate library. Simple,easy to use

== Why EasyByte?

  • JDK's native ByteBuffer that after allocate can't update capacity, EasyByte can create a dynamic ByteBuffer.
  • Strings are something we need to add frequently but ByteBuffer only support byte array.
  • If you have a container like List,Map,must design a format policy,EasyByte can easy to use.
  • Annoyed by the read and write mode of the native ByteBuffer. ByteBuffer created from EasyByte is read-write separated.

== How to use?

=== Maven [source,java,indent=0]

    <dependency>
        <groupId>io.github.gongxuanzhang</groupId>
        <artifactId>easyByte-core</artifactId>
        <version>0.0.1</version>
    </dependency>

=== Gradle [source,gradle,indent=0]

kotlin:
implementation("io.github.gongxuanzhang:easyByte-core:0.0.1")

groovy:
implementation group: 'io.github.gongxuanzhang', name: 'easyByte-core', version: '0.0.1'

== Some API

[source,java,indent=0]

import org.gongxuanzhang.easybyte.core.DynamicByteBuffer;

import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map;

public class HowToUse {

public static void main(String[] args) {
    DynamicByteBuffer allocate = DynamicByteBuffer.allocate();
    allocate.appendString("hello world");
    allocate.appendCollection(helloList());
    allocate.appendMap(helloMap());

    String helloWorld = allocate.getString();
    List<String> list = allocate.getCollection(String.class);
    Map<String, String> map = allocate.getMap(String.class, String.class);
    System.out.println(helloWorld); //  hello world
    System.out.println(list);    //  [hello, world]
    System.out.println(map);   //  {hello=world}
}

private static List<String> helloList() {
    return Arrays.asList("hello", "world");
}

private static Map<String, String> helloMap() {
    return Collections.singletonMap("hello", "world");
}

}


== Contributing

If you like EasyByte, star it please.

Please feel free to submit an link:https://github.com/gongxuanzhang/EasyByte/issues/new[issue].

Fork and link:https://github.com/gongxuanzhang/EasyByte/pulls[PR] are always welcomed.