Skip to content

b0noI/Bencode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

105 Commits
 
 
 
 
 
 
 
 

Repository files navigation

JBS (Java Bencode Serialization)

This project allows you to serialize and desirilze POJO to Bencode format.

Because Benoced format itself don't have enough information to discribe how POJO should be serialized to Bencode this project use it's own protocol of Serilization over Bencode with name JBSF (Java Bencode Serialization Format)

Bencode format

more about bencode format - http://en.wikipedia.org/wiki/Bencode

JBSF

This format describes how POJO should be serialized and deserialized to Bencode format.

For details see wiki: https://github.com/b0noI/Bencode/wiki/Java-Bencode-Serialization-Format-(JBSF)

Adding library to project

For using this lib xustom Maven repo shuld be added to project:

 <repositories>
   <repository>
   <id>aif.com</id>
   <url>http://192.241.238.122:8081/artifactory/libs-snapshot-local/</url>
   </repository>
 </repositories>

And add dependency like this:

<dependency>
    <groupId>com.bencode</groupId>
    <artifactId>serialization</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>

Usage

Example of serialization of POJO to Bencode:

// imports
import com.bencode.serializator.referance.ISerializer;
import com.bencode.deserializator.referance.IDeserializer;


// Pojo for serialization
public static class Pojo {

  public Integer[][] ref;
  
}


// ...
Pojo pojo = new Pojo();
final ISerializer serializer = ISerializer.getSerializer();

// bytes - POJO in Bencode format
final byte[] bytes = serializer.serialize(pojo).getElement();

// deserializing from BEncode format
final Pojo pojo2 = IDeserializer.deserialize(bytes);

// ...

Links

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages