    001    package net.minecraft.src;
    002
    003    import java.io.DataInput;
    004    import java.io.DataOutput;
    005    import java.io.IOException;
    006    import java.util.Arrays;
    007
    008    public class NBTTagByteArray extends NBTBase
    009    {
    010        /** The byte array stored in the tag. */
    011        public byte[] byteArray;
    012
    013        public NBTTagByteArray(String par1Str)
    014        {
    015            super(par1Str);
    016        }
    017
    018        public NBTTagByteArray(String par1Str, byte[] par2ArrayOfByte)
    019        {
    020            super(par1Str);
    021            this.byteArray = par2ArrayOfByte;
    022        }
    023
    024        /**
    025         * Write the actual data contents of the tag, implemented in NBT extension classes
    026         */
    027        void write(DataOutput par1DataOutput) throws IOException
    028        {
    029            par1DataOutput.writeInt(this.byteArray.length);
    030            par1DataOutput.write(this.byteArray);
    031        }
    032
    033        /**
    034         * Read the actual data contents of the tag, implemented in NBT extension classes
    035         */
    036        void load(DataInput par1DataInput) throws IOException
    037        {
    038            int var2 = par1DataInput.readInt();
    039            this.byteArray = new byte[var2];
    040            par1DataInput.readFully(this.byteArray);
    041        }
    042
    043        /**
    044         * Gets the type byte for the tag.
    045         */
    046        public byte getId()
    047        {
    048            return (byte)7;
    049        }
    050
    051        public String toString()
    052        {
    053            return "[" + this.byteArray.length + " bytes]";
    054        }
    055
    056        /**
    057         * Creates a clone of the tag.
    058         */
    059        public NBTBase copy()
    060        {
    061            byte[] var1 = new byte[this.byteArray.length];
    062            System.arraycopy(this.byteArray, 0, var1, 0, this.byteArray.length);
    063            return new NBTTagByteArray(this.getName(), var1);
    064        }
    065
    066        public boolean equals(Object par1Obj)
    067        {
    068            return super.equals(par1Obj) ? Arrays.equals(this.byteArray, ((NBTTagByteArray)par1Obj).byteArray) : false;
    069        }
    070
    071        public int hashCode()
    072        {
    073            return super.hashCode() ^ Arrays.hashCode(this.byteArray);
    074        }
    075    }