NBTTagByteArray .java

net.minecraft.nbt.NBTTagByteArray (class, 78 lines): members: getByteArray, copy, data, getId, hashCode, equals, toString. strings: " bytes]".

net.minecraft.nbtclass78 linescommonextends NBTBase1.7 KB

API Surface (6)

byte getId()
String toString()
NBTBase copy()
boolean equals(Object p_equals_1_)
int hashCode()
byte[] getByteArray()

Fields & Constants (1)

data

String literals (1)

" bytes]"

Code Graph: Dependencies (2)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

NBTTagByteArray.java78 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.nbt;
2
3
import java.io.DataInput;
4
import java.io.DataOutput;
5
import java.io.IOException;
6
import java.util.Arrays;
7
8
public class NBTTagByteArray extends NBTBase
9
{
10
    /** The byte array stored in the tag. */
11
    private byte[] data;
12
13
    NBTTagByteArray()
14
    {
15
    }
16
17
    public NBTTagByteArray(byte[] data)
18
    {
19
        this.data = data;
20
    }
21
22
    /**
23
     * Write the actual data contents of the tag, implemented in NBT extension classes
24
     */
25
    void write(DataOutput output) throws IOException
26
    {
27
        output.writeInt(this.data.length);
28
        output.write(this.data);
29
    }
30
31
    void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException
32
    {
33
        sizeTracker.read(192L);
34
        int i = input.readInt();
35
        sizeTracker.read((long)(8 * i));
36
        this.data = new byte[i];
37
        input.readFully(this.data);
38
    }
39
40
    /**
41
     * Gets the type byte for the tag.
42
     */
43
    public byte getId()
44
    {
45
        return (byte)7;
46
    }
47
48
    public String toString()
49
    {
50
        return "[" + this.data.length + " bytes]";
51
    }
52
53
    /**
54
     * Creates a clone of the tag.
55
     */
56
    public NBTBase copy()
57
    {
58
        byte[] abyte = new byte[this.data.length];
59
        System.arraycopy(this.data, 0, abyte, 0, this.data.length);
60
        return new NBTTagByteArray(abyte);
61
    }
62
63
    public boolean equals(Object p_equals_1_)
64
    {
65
        return super.equals(p_equals_1_) ? Arrays.equals(this.data, ((NBTTagByteArray)p_equals_1_).data) : false;
66
    }
67
68
    public int hashCode()
69
    {
70
        return super.hashCode() ^ Arrays.hashCode(this.data);
71
    }
72
73
    public byte[] getByteArray()
74
    {
75
        return this.data;
76
    }
77
}
78

Deobfuscated MCP 1.8.9 source of NBTTagByteArray from Marcelektro/MavenMCP-1.8.9 (net/minecraft/nbt/NBTTagByteArray.java), stored verbatim.