More javadoc cleanup

This commit is contained in:
Christian 2013-07-02 19:39:02 -04:00
parent aaaffda3f0
commit e45767d20a
7 changed files with 68 additions and 53 deletions

View file

@ -83,7 +83,7 @@ import cpw.mods.fml.relauncher.Side;
/** /**
* Handles primary communication from hooked code into the system * Handles primary communication from hooked code into the system
* *
* The FML entry point is {@link #beginMinecraftLoading(Minecraft)} called from * The FML entry point is {@link #beginMinecraftLoading(Minecraft, List)} called from
* {@link Minecraft} * {@link Minecraft}
* *
* Obfuscated code should focus on this class and other members of the "server" * Obfuscated code should focus on this class and other members of the "server"
@ -137,7 +137,7 @@ public class FMLClientHandler implements IFMLSidedHandler
* Called to start the whole game off * Called to start the whole game off
* *
* @param minecraft The minecraft instance being launched * @param minecraft The minecraft instance being launched
* @param field_110449_ao * @param resourcePackList The resource pack list we will populate with mods
*/ */
public void beginMinecraftLoading(Minecraft minecraft, List resourcePackList) public void beginMinecraftLoading(Minecraft minecraft, List resourcePackList)
{ {

View file

@ -20,6 +20,7 @@ import java.lang.annotation.Target;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.network.packet.Packet250CustomPayload; import net.minecraft.network.packet.Packet250CustomPayload;
import cpw.mods.fml.common.event.FMLEvent;
import cpw.mods.fml.common.event.FMLFingerprintViolationEvent; import cpw.mods.fml.common.event.FMLFingerprintViolationEvent;
import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms; import cpw.mods.fml.common.event.FMLInterModComms;
@ -68,6 +69,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
* // Do stuff in pre-init phase (read config, create blocks and items, register them) * // Do stuff in pre-init phase (read config, create blocks and items, register them)
* } * }
* } * }
* }
* </pre> * </pre>
* *
* @author cpw * @author cpw

View file

@ -40,6 +40,7 @@ import java.lang.annotation.Target;
* public class ClientProxy extends CommonProxy { * public class ClientProxy extends CommonProxy {
* // Override common stuff with client specific stuff here * // Override common stuff with client specific stuff here
* } * }
* }
* </pre> * </pre>
* @author cpw * @author cpw
* *

View file

@ -13,7 +13,17 @@
package cpw.mods.fml.relauncher; package cpw.mods.fml.relauncher;
public enum Side { public enum Side {
CLIENT, SERVER;
/**
* The client side. Specifically, an environment where rendering capability exists.
* Usually in the game client.
*/
CLIENT,
/**
* The server side. Specifically, an environment where NO rendering capability exists.
* Usually on the dedicated server.
*/
SERVER;
/** /**
* @return If this is the server environment * @return If this is the server environment

View file

@ -62,12 +62,12 @@ import java.nio.channels.ReadableByteChannel;
* Newer versions may eventually support paging in/out of checksums. * Newer versions may eventually support paging in/out of checksums.
*/ */
public class Delta { public class Delta {
/** /**
* Debug flag. * Debug flag.
*/ */
final static boolean debug = false; final static boolean debug = false;
/** /**
* Default size of 16. * Default size of 16.
* For "Lorem ipsum" text files (see the tests) the ideal size is about 14. * For "Lorem ipsum" text files (see the tests) the ideal size is about 14.
@ -76,16 +76,16 @@ public class Delta {
* Use a size like 64 or 128 for large files. * Use a size like 64 or 128 for large files.
*/ */
public static final int DEFAULT_CHUNK_SIZE = 1<<4; public static final int DEFAULT_CHUNK_SIZE = 1<<4;
/** /**
* Chunk Size. * Chunk Size.
*/ */
private int S; private int S;
private SourceState source; private SourceState source;
private TargetState target; private TargetState target;
private DiffWriter output; private DiffWriter output;
/** /**
* Constructs a new Delta. * Constructs a new Delta.
* In the future, additional constructor arguments will set the algorithm details. * In the future, additional constructor arguments will set the algorithm details.
@ -93,12 +93,12 @@ public class Delta {
public Delta() { public Delta() {
setChunkSize(DEFAULT_CHUNK_SIZE); setChunkSize(DEFAULT_CHUNK_SIZE);
} }
/** /**
* Sets the chunk size used. * Sets the chunk size used.
* Larger chunks are faster and use less memory, but create larger patches * Larger chunks are faster and use less memory, but create larger patches
* as well. * as well.
* *
* @param size * @param size
*/ */
public void setChunkSize(int size) { public void setChunkSize(int size) {
@ -106,17 +106,17 @@ public class Delta {
throw new IllegalArgumentException("Invalid size"); throw new IllegalArgumentException("Invalid size");
S = size; S = size;
} }
/** /**
* Compares the source bytes with target bytes, writing to output. * Compares the source bytes with target bytes, writing to output.
*/ */
public void compute(byte source[], byte target[], OutputStream output) public void compute(byte source[], byte target[], OutputStream output)
throws IOException { throws IOException {
compute(new ByteBufferSeekableSource(source), compute(new ByteBufferSeekableSource(source),
new ByteArrayInputStream(target), new ByteArrayInputStream(target),
new GDiffWriter(output)); new GDiffWriter(output));
} }
/** /**
* Compares the source bytes with target bytes, returning output. * Compares the source bytes with target bytes, returning output.
*/ */
@ -126,20 +126,20 @@ public class Delta {
compute(source, target, os); compute(source, target, os);
return os.toByteArray(); return os.toByteArray();
} }
/** /**
* Compares the source bytes with target input, writing to output. * Compares the source bytes with target input, writing to output.
*/ */
public void compute(byte[] sourceBytes, InputStream inputStream, public void compute(byte[] sourceBytes, InputStream inputStream,
DiffWriter diffWriter) throws IOException DiffWriter diffWriter) throws IOException
{ {
compute(new ByteBufferSeekableSource(sourceBytes), compute(new ByteBufferSeekableSource(sourceBytes),
inputStream, diffWriter); inputStream, diffWriter);
} }
/** /**
* Compares the source file with a target file, writing to output. * Compares the source file with a target file, writing to output.
* *
* @param output will be closed * @param output will be closed
*/ */
public void compute(File sourceFile, File targetFile, DiffWriter output) public void compute(File sourceFile, File targetFile, DiffWriter output)
@ -153,25 +153,25 @@ public class Delta {
is.close(); is.close();
} }
} }
/** /**
* Compares the source with a target, writing to output. * Compares the source with a target, writing to output.
* *
* @param output will be closed * @param output will be closed
*/ */
public void compute(SeekableSource seekSource, InputStream targetIS, DiffWriter output) public void compute(SeekableSource seekSource, InputStream targetIS, DiffWriter output)
throws IOException { throws IOException {
if (debug) { if (debug) {
debug("using match length S = " + S); debug("using match length S = " + S);
} }
source = new SourceState(seekSource); source = new SourceState(seekSource);
target = new TargetState(targetIS); target = new TargetState(targetIS);
this.output = output; this.output = output;
if (debug) if (debug)
debug("checksums " + source.checksum); debug("checksums " + source.checksum);
while (!target.eof()) { while (!target.eof()) {
debug("!target.eof()"); debug("!target.eof()");
int index = target.find(source); int index = target.find(source);
@ -196,7 +196,7 @@ public class Delta {
} }
output.close(); output.close();
} }
private void addData() throws IOException { private void addData() throws IOException {
int i = target.read(); int i = target.read();
if (debug) if (debug)
@ -205,12 +205,12 @@ public class Delta {
return; return;
output.addData((byte)i); output.addData((byte)i);
} }
class SourceState { class SourceState {
private Checksum checksum; private Checksum checksum;
private SeekableSource source; private SeekableSource source;
public SourceState(SeekableSource source) throws IOException { public SourceState(SeekableSource source) throws IOException {
checksum = new Checksum(source, S); checksum = new Checksum(source, S);
this.source = source; this.source = source;
@ -232,23 +232,23 @@ public class Delta {
" source=" + this.source + " source=" + this.source +
""; "";
} }
} }
class TargetState { class TargetState {
private ReadableByteChannel c; private ReadableByteChannel c;
private ByteBuffer tbuf = ByteBuffer.allocate(blocksize()); private ByteBuffer tbuf = ByteBuffer.allocate(blocksize());
private ByteBuffer sbuf = ByteBuffer.allocate(blocksize()); private ByteBuffer sbuf = ByteBuffer.allocate(blocksize());
private long hash; private long hash;
private boolean hashReset = true; private boolean hashReset = true;
private boolean eof; private boolean eof;
TargetState(InputStream targetIS) throws IOException { TargetState(InputStream targetIS) throws IOException {
c = Channels.newChannel(targetIS); c = Channels.newChannel(targetIS);
tbuf.limit(0); tbuf.limit(0);
} }
private int blocksize() { private int blocksize() {
return Math.min(1024 * 16, S * 4); return Math.min(1024 * 16, S * 4);
} }
@ -362,13 +362,13 @@ public class Delta {
" eof=" + this.eof + " eof=" + this.eof +
"]"; "]";
} }
private String dump() { return dump(tbuf); } private String dump() { return dump(tbuf); }
private String dump(ByteBuffer bb) { private String dump(ByteBuffer bb) {
return getTextDump(bb); return getTextDump(bb);
} }
private void append(StringBuffer sb, int value) { private void append(StringBuffer sb, int value) {
char b1 = (char)((value >> 4) & 0x0F); char b1 = (char)((value >> 4) & 0x0F);
char b2 = (char)((value) & 0x0F); char b2 = (char)((value) & 0x0F);
@ -392,7 +392,7 @@ public class Delta {
} }
} }
/** /**
* Creates a patch using file names. * Creates a patch using file names.
*/ */
@ -426,6 +426,7 @@ public class Delta {
"source or target is too large, max length is " "source or target is too large, max length is "
+ Integer.MAX_VALUE); + Integer.MAX_VALUE);
System.err.println("aborting.."); System.err.println("aborting..");
output.close();
return; return;
} }
@ -437,7 +438,7 @@ public class Delta {
if (debug) //gls031504a if (debug) //gls031504a
System.out.println("finished generating delta"); System.out.println("finished generating delta");
} }
private void debug(String s) { private void debug(String s) {
if (debug) if (debug)
System.err.println(s); System.err.println(s);

View file

@ -1,4 +1,4 @@
/* /*
* *
* Copyright (c) 2001 Torgeir Veimo * Copyright (c) 2001 Torgeir Veimo
* *
@ -31,26 +31,26 @@ import java.io.IOException;
* Interface for DIFF writers. * Interface for DIFF writers.
*/ */
public interface DiffWriter extends Closeable { public interface DiffWriter extends Closeable {
/** /**
* Add a GDIFF copy instruction. * Add a GDIFF copy instruction.
*/ */
public void addCopy(long offset, int length) throws IOException; public void addCopy(long offset, int length) throws IOException;
/** /**
* Add a GDIFF data instruction. * Add a GDIFF data instruction.
* Implementors should buffer the data. * Implementors should buffer the data.
*/ */
public void addData(byte b) throws IOException; public void addData(byte b) throws IOException;
/** /**
* Flushes to output, e.g. any data added. * Flushes to output, e.g. any data added.
*/ */
public void flush() throws IOException; public void flush() throws IOException;
/** /**
* Closes this stream. * Closes this stream.
* Note that {@link Diff} will invoke this method at the end. * Note that {@link DiffWriter} will invoke this method at the end.
*/ */
public void close() throws IOException; public void close() throws IOException;
} }

View file

@ -52,13 +52,14 @@ import java.io.RandomAccessFile;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
/** /**
* This class patches an input file with a GDIFF patch fil<EFBFBD>e. * This class patches an input file with a GDIFF patch file.
* *
* The patch file follows the GDIFF file specification available at * The patch file follows the GDIFF file specification available at
* {@link http://www.w3.org/TR/NOTE-gdiff-19970901.html}. *
* <a href="http://www.w3.org/TR/NOTE-gdiff-19970901.html">http://www.w3.org/TR/NOTE-gdiff-19970901.html</a>.
*/ */
public class GDiffPatcher { public class GDiffPatcher {
private ByteBuffer buf = ByteBuffer.allocate(1024); private ByteBuffer buf = ByteBuffer.allocate(1024);
private byte buf2[] = buf.array(); private byte buf2[] = buf.array();
@ -67,14 +68,14 @@ public class GDiffPatcher {
*/ */
public GDiffPatcher() { public GDiffPatcher() {
} }
/** /**
* Patches to an output file. * Patches to an output file.
*/ */
public void patch(File sourceFile, File patchFile, File outputFile) public void patch(File sourceFile, File patchFile, File outputFile)
throws IOException throws IOException
{ {
RandomAccessFileSeekableSource source =new RandomAccessFileSeekableSource(new RandomAccessFile(sourceFile, "r")); RandomAccessFileSeekableSource source =new RandomAccessFileSeekableSource(new RandomAccessFile(sourceFile, "r"));
InputStream patch = new FileInputStream(patchFile); InputStream patch = new FileInputStream(patchFile);
OutputStream output = new FileOutputStream(outputFile); OutputStream output = new FileOutputStream(outputFile);
try { try {
@ -87,14 +88,14 @@ public class GDiffPatcher {
output.close(); output.close();
} }
} }
/** /**
* Patches to an output stream. * Patches to an output stream.
*/ */
public void patch(byte[] source, InputStream patch, OutputStream output) throws IOException { public void patch(byte[] source, InputStream patch, OutputStream output) throws IOException {
patch(new ByteBufferSeekableSource(source), patch, output); patch(new ByteBufferSeekableSource(source), patch, output);
} }
/** /**
* Patches in memory, returning the patch result. * Patches in memory, returning the patch result.
*/ */
@ -103,12 +104,12 @@ public class GDiffPatcher {
patch(source, new ByteArrayInputStream(patch), os); patch(source, new ByteArrayInputStream(patch), os);
return os.toByteArray(); return os.toByteArray();
} }
/** /**
* Patches to an output stream. * Patches to an output stream.
*/ */
public void patch(SeekableSource source, InputStream patch, OutputStream out) throws IOException { public void patch(SeekableSource source, InputStream patch, OutputStream out) throws IOException {
DataOutputStream outOS = new DataOutputStream(out); DataOutputStream outOS = new DataOutputStream(out);
DataInputStream patchIS = new DataInputStream(patch); DataInputStream patchIS = new DataInputStream(patch);
@ -128,12 +129,12 @@ public class GDiffPatcher {
break; break;
int length; int length;
int offset; int offset;
if (command <= DATA_MAX) { if (command <= DATA_MAX) {
append(command, patchIS, outOS); append(command, patchIS, outOS);
continue; continue;
} }
switch (command) { switch (command) {
case DATA_USHORT: // ushort, n bytes following; append case DATA_USHORT: // ushort, n bytes following; append
length = patchIS.readUnsignedShort(); length = patchIS.readUnsignedShort();
@ -178,7 +179,7 @@ public class GDiffPatcher {
length = patchIS.readInt(); length = patchIS.readInt();
copy(loffset, length, source, outOS); copy(loffset, length, source, outOS);
break; break;
default: default:
throw new IllegalStateException("command " + command); throw new IllegalStateException("command " + command);
} }
} }