Fix Javadocs and code issues.

This commit is contained in:
sk89q
2014-07-29 11:04:04 -07:00
parent 8834af7538
commit 1dc84d2511
230 changed files with 1646 additions and 1882 deletions

View File

@@ -20,10 +20,7 @@
package com.sk89q.jnbt;
/**
* The <code>TAG_End</code> tag.
*
* @author Graham Edgecombe
*
* The {@code TAG_End} tag.
*/
public final class EndTag extends Tag {

View File

@@ -71,7 +71,7 @@ public final class IntArrayTag extends Tag {
if (name != null && !name.equals("")) {
append = "(\"" + this.getName() + "\")";
}
return "TAG_Int_Array" + append + ": " + hex.toString();
return "TAG_Int_Array" + append + ": " + hex;
}
}

View File

@@ -437,12 +437,9 @@ public final class ListTag extends Tag {
append = "(\"" + this.getName() + "\")";
}
StringBuilder bldr = new StringBuilder();
bldr.append("TAG_List" + append + ": " + value.size()
+ " entries of type " + NBTUtils.getTypeName(type)
+ "\r\n{\r\n");
bldr.append("TAG_List").append(append).append(": ").append(value.size()).append(" entries of type ").append(NBTUtils.getTypeName(type)).append("\r\n{\r\n");
for (Tag t : value) {
bldr.append(" " + t.toString().replaceAll("\r\n", "\r\n ")
+ "\r\n");
bldr.append(" ").append(t.toString().replaceAll("\r\n", "\r\n ")).append("\r\n");
}
bldr.append("}");
return bldr.toString();

View File

@@ -23,9 +23,6 @@ import java.nio.charset.Charset;
/**
* A class which holds constant values.
*
* @author Graham Edgecombe
*
*/
public final class NBTConstants {

View File

@@ -29,20 +29,13 @@ import java.util.List;
import java.util.Map;
/**
* <p>
* This class reads <strong>NBT</strong>, or <strong>Named Binary Tag</strong>
* streams, and produces an object graph of subclasses of the <code>Tag</code>
* streams, and produces an object graph of subclasses of the {@code Tag}
* object.
* </p>
*
* <p>
* The NBT format was created by Markus Persson, and the specification may be
* <p>The NBT format was created by Markus Persson, and the specification may be
* found at <a href="http://www.minecraft.net/docs/NBT.txt">
* http://www.minecraft.net/docs/NBT.txt</a>.
* </p>
*
* @author Graham Edgecombe
*
* http://www.minecraft.net/docs/NBT.txt</a>.</p>
*/
public final class NBTInputStream implements Closeable {

View File

@@ -26,19 +26,12 @@ import java.io.OutputStream;
import java.util.List;
/**
* <p>
* This class writes <strong>NBT</strong>, or <strong>Named Binary Tag</strong>
* <code>Tag</code> objects to an underlying <code>OutputStream</code>.
* </p>
* {@code Tag} objects to an underlying {@code OutputStream}.
*
* <p>
* The NBT format was created by Markus Persson, and the specification may be
* <p>The NBT format was created by Markus Persson, and the specification may be
* found at <a href="http://www.minecraft.net/docs/NBT.txt">
* http://www.minecraft.net/docs/NBT.txt</a>.
* </p>
*
* @author Graham Edgecombe
*
* http://www.minecraft.net/docs/NBT.txt</a>.</p>
*/
public final class NBTOutputStream implements Closeable {
@@ -48,7 +41,7 @@ public final class NBTOutputStream implements Closeable {
private final DataOutputStream os;
/**
* Creates a new <code>NBTOutputStream</code>, which will write data to the
* Creates a new {@code NBTOutputStream}, which will write data to the
* specified underlying output stream.
*
* @param os
@@ -137,7 +130,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
* Writes a <code>TAG_Byte</code> tag.
* Writes a {@code TAG_Byte} tag.
*
* @param tag
* The tag.
@@ -149,7 +142,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
* Writes a <code>TAG_Byte_Array</code> tag.
* Writes a {@code TAG_Byte_Array} tag.
*
* @param tag
* The tag.
@@ -163,7 +156,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
* Writes a <code>TAG_Compound</code> tag.
* Writes a {@code TAG_Compound} tag.
*
* @param tag
* The tag.
@@ -178,7 +171,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
* Writes a <code>TAG_List</code> tag.
* Writes a {@code TAG_List} tag.
*
* @param tag
* The tag.
@@ -192,13 +185,13 @@ public final class NBTOutputStream implements Closeable {
os.writeByte(NBTUtils.getTypeCode(clazz));
os.writeInt(size);
for (int i = 0; i < size; ++i) {
writeTagPayload(tags.get(i));
for (Tag tag1 : tags) {
writeTagPayload(tag1);
}
}
/**
* Writes a <code>TAG_String</code> tag.
* Writes a {@code TAG_String} tag.
*
* @param tag
* The tag.
@@ -212,7 +205,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
* Writes a <code>TAG_Double</code> tag.
* Writes a {@code TAG_Double} tag.
*
* @param tag
* The tag.
@@ -224,7 +217,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
* Writes a <code>TAG_Float</code> tag.
* Writes a {@code TAG_Float} tag.
*
* @param tag
* The tag.
@@ -236,7 +229,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
* Writes a <code>TAG_Long</code> tag.
* Writes a {@code TAG_Long} tag.
*
* @param tag
* The tag.
@@ -248,7 +241,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
* Writes a <code>TAG_Int</code> tag.
* Writes a {@code TAG_Int} tag.
*
* @param tag
* The tag.
@@ -260,7 +253,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
* Writes a <code>TAG_Short</code> tag.
* Writes a {@code TAG_Short} tag.
*
* @param tag
* The tag.
@@ -272,12 +265,9 @@ public final class NBTOutputStream implements Closeable {
}
/**
* Writes a <code>TAG_Empty</code> tag.
* Writes a {@code TAG_Empty} tag.
*
* @param tag
* The tag.
* @throws IOException
* if an I/O error occurs.
* @param tag the tag
*/
private void writeEndTagPayload(EndTag tag) {
/* empty */
@@ -286,11 +276,12 @@ public final class NBTOutputStream implements Closeable {
private void writeIntArrayTagPayload(IntArrayTag tag) throws IOException {
int[] data = tag.getValue();
os.writeInt(data.length);
for (int i = 0; i < data.length; i++) {
os.writeInt(data[i]);
for (int aData : data) {
os.writeInt(aData);
}
}
@Override
public void close() throws IOException {
os.close();
}

View File

@@ -20,8 +20,6 @@
package com.sk89q.jnbt;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.storage.InvalidFormatException;
import java.util.Map;
@@ -171,14 +169,13 @@ public final class NBTUtils {
/**
* Get child tag of a NBT structure.
*
* @param items
* @param key
* @param expected
* @param items the map to read from
* @param key the key to look for
* @param expected the expected NBT class type
* @return child tag
* @throws InvalidFormatException
*/
public static <T extends Tag> T getChildTag(Map<String,Tag> items, String key,
Class<T> expected) throws InvalidFormatException {
public static <T extends Tag> T getChildTag(Map<String, Tag> items, String key, Class<T> expected) throws InvalidFormatException {
if (!items.containsKey(key)) {
throw new InvalidFormatException("Missing a \"" + key + "\" tag");
}