public static NBT_Tag make(InputStream is) throws Exception {
  NBT_Tag ret=null;
  DataInputStream stream=new DataInputStream(is);
  byte t=stream.readByte();
  int type=(int)t;
  String name="";
  if (type > 0)   name=stream.readUTF();
switch (type) {
case 0:
    ret=new TAG_End(name);
  break;
case 1:
ret=new TAG_Byte(name);
break;
case 2:
ret=new TAG_Short(name);
break;
case 3:
ret=new TAG_Int(name);
break;
case 4:
ret=new TAG_Long(name);
break;
case 5:
ret=new TAG_Float(name);
break;
case 6:
ret=new TAG_Double(name);
break;
case 7:
ret=new TAG_Byte_Array(name);
break;
case 8:
ret=new TAG_String(name);
break;
case 9:
ret=new TAG_List(name);
break;
case 10:
ret=new TAG_Compound(name);
break;
case 11:
ret=new TAG_Int_Array(name);
break;
default :
throw (new Exception("NBT_Tag type error: " + type));
}
ret.parse(stream);
return ret;
}

public static NBT_Tag make ( InputStream is ) throws Exception { NBT_Tag ret = null ; DataInputStream stream = new DataInputStream ( is ) ; byte t = stream . readByte ( ) ; int type = ( int ) t ; String name = "" ; if ( type > 0 ) name = stream . readUTF ( ) ; switch ( type ) { case 0 : ret = new TAG_End ( name ) ; break ; case 1 : ret = new TAG_Byte ( name ) ; break ; case 2 : ret = new TAG_Short ( name ) ; break ; case 3 : ret = new TAG_Int ( name ) ; break ; case 4 : ret = new TAG_Long ( name ) ; break ; case 5 : ret = new TAG_Float ( name ) ; break ; case 6 : ret = new TAG_Double ( name ) ; break ; case 7 : ret = new TAG_Byte_Array ( name ) ; break ; case 8 : ret = new TAG_String ( name ) ; break ; case 9 : ret = new TAG_List ( name ) ; break ; case 10 : ret = new TAG_Compound ( name ) ; break ; case 11 : ret = new TAG_Int_Array ( name ) ; break ; default : throw ( new Exception ( "NBT_Tag type error: " + type ) ) ; } ret . parse ( stream ) ; return ret ; }
main loading routine . reads the tag starting from the current point in the input stream . if the tag is a collection , it also recursively reads the internal items .
