hexed

package module
v0.0.0-...-7ce01fe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2022 License: MIT Imports: 2 Imported by: 0

README

Hex-editor style encoder for go

PkgGoDev

Installation

go get github.com/kitschysynq/hexed

Quickstart

package main

import (
	"fmt"
	"os"

	"github.com/kitschysynq/hexed"
)

func main() {
	w := hexed.NewEncoder(os.Stdout)
	defer w.Close()

	fmt.Fprintf(w, "this is a totally rad example")
}

And that will produce output like this:

00000000: 7468 6973 2069 7320 6120 746f 7461 6c6c  this is a totall
00000010: 7920 7261 6420 6578 616d 706c 65         y rad example

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEncoder

func NewEncoder(w io.Writer) io.WriteCloser

NewEncoder returns an encoder object wrapping the given io.Writer. An encoder writes hex-editor-style lines to the wrapped io.Writer. For each 16-byte chunk of data written to the Encoder, a single line will be written to the output. Each line consists of the hexadecimal adress of the first byte on the line, followed byte space-separated, hex-encoded byte pairs, followed by the string representation of the bytes with non-printable characters replaced by '.'.

For example: writing the string 'totally\tradical!' to the Encoder will result in the following being written to the underlying io.Writer:

00000000: 746f 7461 6c6c 7909 7261 6469 6361 6c21 totally.radical!

The caller must Close the encoder to flush any partially written blocks.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL