Welcome

Welcome to my personal website and blog. My name is Graham Edgecombe and I live in the United Kingdom. Some of my hobbies include programming, website design, photography and electronics. This website contains information about me and my projects, some (irregular) blog posts and a collection of recent tweets, links and photos. I hope you enjoy it!

Blog

JNBT

22 January 2010

NBT, or Named Binary Tag, is a file format created by Markus Persson for use with Minecraft levels. It is a fairly simple format, but no open-source implementations exist yet.

Since I like messing around with Minecraft modding, level generation, etc, I decided to write a Java library for reading and writing these files. Named JNBT (yes, I suck at naming projects!), it offers two main classes to deal with reading and writing the files: NBTInputStream and NBTOutputStream. These wrap around underlying InputStreams and OutputStreams to allow them to be written to files, network sockets, or indeed, any Input or OutputStream in Java.

The NBT format, as suggested from the name, is based around 'tag' objects. There are several variations, such as ones for numerical values (byte, short, int, long, float, double) as well as byte arrays, UTF8 strings, lists and maps (using the compound tag).

JNBT has an abstract class named Tag, and then several subclasses such as ByteTag, ListTag, CompoundTag, StringTag, etc. The ListTag and CompoundTag classes contain other Tag objects.

The parser will recursively read tags and create an object graph of the tags, and give it to the user. An object graph constructed manually can be written out back to the NBT format.

The JNBT source code is available under the 3-clause BSD license and is hosted in SourceForge.

JNBT links:

Permalink · Comments · Blog Archive · RSS Feed

Latest Photos

Venice

Lizard

Dolomites