hex

lightweight library for converting binary to hex and vice versa in a variety of formats

Лицензия

Лицензия

Группа

Группа

com.martiansoftware
Идентификатор

Идентификатор

hex
Последняя версия

Последняя версия

0.1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

hex
lightweight library for converting binary to hex and vice versa in a variety of formats
Ссылка на сайт

Ссылка на сайт

https://github.com/martylamb/hex
Система контроля версий

Система контроля версий

https://github.com/martylamb/hex

Скачать hex

Имя Файла Размер
hex-0.1.0.pom
hex-0.1.0.jar 24 KB
hex-0.1.0-sources.jar 20 KB
hex-0.1.0-javadoc.jar 144 KB
Обзор

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.martiansoftware/hex/ -->
<dependency>
    <groupId>com.martiansoftware</groupId>
    <artifactId>hex</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.martiansoftware/hex/
implementation 'com.martiansoftware:hex:0.1.0'
// https://jarcasting.com/artifacts/com.martiansoftware/hex/
implementation ("com.martiansoftware:hex:0.1.0")
'com.martiansoftware:hex:jar:0.1.0'
<dependency org="com.martiansoftware" name="hex" rev="0.1.0">
  <artifact name="hex" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.martiansoftware', module='hex', version='0.1.0')
)
libraryDependencies += "com.martiansoftware" % "hex" % "0.1.0"
[com.martiansoftware/hex "0.1.0"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
com.martiansoftware : hope-and-doubt jar 0.1.0

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 3.8.1

Модули Проекта

Данный проект не имеет модулей.

martian-hex

Simple tools for encoding binary to hexadecimal and hexadecimal to binary.

Separate HexEncoder (for binary to hex) and HexDecoder (hex to binary) interfaces are provided, as well as HexCodec (both directions).

Several implementations are provided supporting several different hex formats, plus adapters for defining your own. Predefined HexCodecs can be found in StandardHexCodecs.java.

Static methods provided by Hex.java provide quick access to the StandardHexCodecs.DEFAULT HexCodec.

Encoding and Decoding

Encoding methods accept binary via byte arrays and InputStreams and can return Strings or encode directly to PrintStreams or PrintWriters. See HexEncoder.java for all encoding options.

Decoding methods accept hexadecimal in Strings or Readers and can return byte arrays or decode directly to OutputStreams. See HexDecoder.java for all decoding options.

Usage Examples

Bytes to Simple Hex

// byte array to string
byte[] b = "Here is an example.".getBytes();

System.out.println(Hex.encode(b)); // equivalent to StandardHexCodecs.DEFAULT.encode

Output: 4865726520697320616e206578616d706c652e

Simple Hex to Bytes

byte[] b = Hex.decode("4865726520697320616e206578616d706c652e");
System.out.println(new String(b)); // equivalent to StandardHexCodecs.DEFAULT.decode

Output: Here is an example.

Delimited by Colons, 16 bytes per line

String s = "Here is an example.";
StandardHexCodecs.SIMPLE.encode(s.getBytes(), System.out); // the same HexCodec can decode this back to binary as well

Output: 48:65:72:65:20:69:73:20:61:6e:20:65:78:61:6d:70 6c:65:2e

Hex Dump

byte[] b = new byte[67];
Random r = new Random();
r.nextBytes(b);
StandardHexCodecs.HEXDUMP.encode(b, System.out); // the same HexCodec can decode this back to binary as well

Output:

00000000: c9 85 90 e5 3c ca 13 72   82 52 5b c9 39 92 4b 41   ....<..r.R[.9.KA
00000010: b9 a8 f8 9a e9 53 0d a3   18 84 2e c0 8a 80 b5 aa   .....S..........
00000020: af b5 cf b5 25 2a 36 c3   52 ff b1 f2 b4 ae 13 33   ....%*6.R......3
00000030: bf 33 8d ed 17 9c 62 a0   91 80 fc 67 d0 8e 5d 6f   .3....b....g..]o
00000040: 8f af 85    

Версии библиотеки

Версия
0.1.0