More javadoc cleanup
This commit is contained in:
parent
aaaffda3f0
commit
e45767d20a
7 changed files with 68 additions and 53 deletions
|
@ -83,7 +83,7 @@ import cpw.mods.fml.relauncher.Side;
|
|||
/**
|
||||
* 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}
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.lang.annotation.Target;
|
|||
import net.minecraft.item.ItemBlock;
|
||||
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.FMLInitializationEvent;
|
||||
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)
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @author cpw
|
||||
|
|
|
@ -40,6 +40,7 @@ import java.lang.annotation.Target;
|
|||
* public class ClientProxy extends CommonProxy {
|
||||
* // Override common stuff with client specific stuff here
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
* @author cpw
|
||||
*
|
||||
|
|
|
@ -13,7 +13,17 @@
|
|||
package cpw.mods.fml.relauncher;
|
||||
|
||||
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
|
||||
|
|
|
@ -62,12 +62,12 @@ import java.nio.channels.ReadableByteChannel;
|
|||
* Newer versions may eventually support paging in/out of checksums.
|
||||
*/
|
||||
public class Delta {
|
||||
|
||||
|
||||
/**
|
||||
* Debug flag.
|
||||
*/
|
||||
final static boolean debug = false;
|
||||
|
||||
|
||||
/**
|
||||
* Default size of 16.
|
||||
* 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.
|
||||
*/
|
||||
public static final int DEFAULT_CHUNK_SIZE = 1<<4;
|
||||
|
||||
|
||||
/**
|
||||
* Chunk Size.
|
||||
*/
|
||||
private int S;
|
||||
|
||||
|
||||
private SourceState source;
|
||||
private TargetState target;
|
||||
private DiffWriter output;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new Delta.
|
||||
* In the future, additional constructor arguments will set the algorithm details.
|
||||
|
@ -93,12 +93,12 @@ public class Delta {
|
|||
public Delta() {
|
||||
setChunkSize(DEFAULT_CHUNK_SIZE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the chunk size used.
|
||||
* Larger chunks are faster and use less memory, but create larger patches
|
||||
* as well.
|
||||
*
|
||||
*
|
||||
* @param size
|
||||
*/
|
||||
public void setChunkSize(int size) {
|
||||
|
@ -106,17 +106,17 @@ public class Delta {
|
|||
throw new IllegalArgumentException("Invalid size");
|
||||
S = size;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compares the source bytes with target bytes, writing to output.
|
||||
*/
|
||||
public void compute(byte source[], byte target[], OutputStream output)
|
||||
throws IOException {
|
||||
compute(new ByteBufferSeekableSource(source),
|
||||
compute(new ByteBufferSeekableSource(source),
|
||||
new ByteArrayInputStream(target),
|
||||
new GDiffWriter(output));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compares the source bytes with target bytes, returning output.
|
||||
*/
|
||||
|
@ -126,20 +126,20 @@ public class Delta {
|
|||
compute(source, target, os);
|
||||
return os.toByteArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compares the source bytes with target input, writing to output.
|
||||
*/
|
||||
public void compute(byte[] sourceBytes, InputStream inputStream,
|
||||
DiffWriter diffWriter) throws IOException
|
||||
{
|
||||
compute(new ByteBufferSeekableSource(sourceBytes),
|
||||
compute(new ByteBufferSeekableSource(sourceBytes),
|
||||
inputStream, diffWriter);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compares the source file with a target file, writing to output.
|
||||
*
|
||||
*
|
||||
* @param output will be closed
|
||||
*/
|
||||
public void compute(File sourceFile, File targetFile, DiffWriter output)
|
||||
|
@ -153,25 +153,25 @@ public class Delta {
|
|||
is.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compares the source with a target, writing to output.
|
||||
*
|
||||
*
|
||||
* @param output will be closed
|
||||
*/
|
||||
public void compute(SeekableSource seekSource, InputStream targetIS, DiffWriter output)
|
||||
throws IOException {
|
||||
|
||||
|
||||
if (debug) {
|
||||
debug("using match length S = " + S);
|
||||
}
|
||||
|
||||
|
||||
source = new SourceState(seekSource);
|
||||
target = new TargetState(targetIS);
|
||||
this.output = output;
|
||||
if (debug)
|
||||
debug("checksums " + source.checksum);
|
||||
|
||||
|
||||
while (!target.eof()) {
|
||||
debug("!target.eof()");
|
||||
int index = target.find(source);
|
||||
|
@ -196,7 +196,7 @@ public class Delta {
|
|||
}
|
||||
output.close();
|
||||
}
|
||||
|
||||
|
||||
private void addData() throws IOException {
|
||||
int i = target.read();
|
||||
if (debug)
|
||||
|
@ -205,12 +205,12 @@ public class Delta {
|
|||
return;
|
||||
output.addData((byte)i);
|
||||
}
|
||||
|
||||
|
||||
class SourceState {
|
||||
|
||||
private Checksum checksum;
|
||||
private SeekableSource source;
|
||||
|
||||
|
||||
public SourceState(SeekableSource source) throws IOException {
|
||||
checksum = new Checksum(source, S);
|
||||
this.source = source;
|
||||
|
@ -232,23 +232,23 @@ public class Delta {
|
|||
" source=" + this.source +
|
||||
"";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
class TargetState {
|
||||
|
||||
|
||||
private ReadableByteChannel c;
|
||||
private ByteBuffer tbuf = ByteBuffer.allocate(blocksize());
|
||||
private ByteBuffer sbuf = ByteBuffer.allocate(blocksize());
|
||||
private long hash;
|
||||
private boolean hashReset = true;
|
||||
private boolean eof;
|
||||
|
||||
|
||||
TargetState(InputStream targetIS) throws IOException {
|
||||
c = Channels.newChannel(targetIS);
|
||||
tbuf.limit(0);
|
||||
}
|
||||
|
||||
|
||||
private int blocksize() {
|
||||
return Math.min(1024 * 16, S * 4);
|
||||
}
|
||||
|
@ -362,13 +362,13 @@ public class Delta {
|
|||
" eof=" + this.eof +
|
||||
"]";
|
||||
}
|
||||
|
||||
|
||||
private String dump() { return dump(tbuf); }
|
||||
|
||||
|
||||
private String dump(ByteBuffer bb) {
|
||||
return getTextDump(bb);
|
||||
}
|
||||
|
||||
|
||||
private void append(StringBuffer sb, int value) {
|
||||
char b1 = (char)((value >> 4) & 0x0F);
|
||||
char b2 = (char)((value) & 0x0F);
|
||||
|
@ -392,7 +392,7 @@ public class Delta {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a patch using file names.
|
||||
*/
|
||||
|
@ -426,6 +426,7 @@ public class Delta {
|
|||
"source or target is too large, max length is "
|
||||
+ Integer.MAX_VALUE);
|
||||
System.err.println("aborting..");
|
||||
output.close();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -437,7 +438,7 @@ public class Delta {
|
|||
if (debug) //gls031504a
|
||||
System.out.println("finished generating delta");
|
||||
}
|
||||
|
||||
|
||||
private void debug(String s) {
|
||||
if (debug)
|
||||
System.err.println(s);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2001 Torgeir Veimo
|
||||
*
|
||||
|
@ -31,26 +31,26 @@ import java.io.IOException;
|
|||
* Interface for DIFF writers.
|
||||
*/
|
||||
public interface DiffWriter extends Closeable {
|
||||
|
||||
|
||||
/**
|
||||
* Add a GDIFF copy instruction.
|
||||
*/
|
||||
public void addCopy(long offset, int length) throws IOException;
|
||||
|
||||
|
||||
/**
|
||||
* Add a GDIFF data instruction.
|
||||
* Implementors should buffer the data.
|
||||
*/
|
||||
public void addData(byte b) throws IOException;
|
||||
|
||||
|
||||
/**
|
||||
* Flushes to output, e.g. any data added.
|
||||
*/
|
||||
public void flush() throws IOException;
|
||||
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
|
|
@ -52,13 +52,14 @@ import java.io.RandomAccessFile;
|
|||
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
|
||||
* {@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 {
|
||||
|
||||
|
||||
private ByteBuffer buf = ByteBuffer.allocate(1024);
|
||||
private byte buf2[] = buf.array();
|
||||
|
||||
|
@ -67,14 +68,14 @@ public class GDiffPatcher {
|
|||
*/
|
||||
public GDiffPatcher() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Patches to an output file.
|
||||
*/
|
||||
public void patch(File sourceFile, File patchFile, File outputFile)
|
||||
throws IOException
|
||||
{
|
||||
RandomAccessFileSeekableSource source =new RandomAccessFileSeekableSource(new RandomAccessFile(sourceFile, "r"));
|
||||
RandomAccessFileSeekableSource source =new RandomAccessFileSeekableSource(new RandomAccessFile(sourceFile, "r"));
|
||||
InputStream patch = new FileInputStream(patchFile);
|
||||
OutputStream output = new FileOutputStream(outputFile);
|
||||
try {
|
||||
|
@ -87,14 +88,14 @@ public class GDiffPatcher {
|
|||
output.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Patches to an output stream.
|
||||
*/
|
||||
public void patch(byte[] source, InputStream patch, OutputStream output) throws IOException {
|
||||
patch(new ByteBufferSeekableSource(source), patch, output);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Patches in memory, returning the patch result.
|
||||
*/
|
||||
|
@ -103,12 +104,12 @@ public class GDiffPatcher {
|
|||
patch(source, new ByteArrayInputStream(patch), os);
|
||||
return os.toByteArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Patches to an output stream.
|
||||
*/
|
||||
public void patch(SeekableSource source, InputStream patch, OutputStream out) throws IOException {
|
||||
|
||||
|
||||
DataOutputStream outOS = new DataOutputStream(out);
|
||||
DataInputStream patchIS = new DataInputStream(patch);
|
||||
|
||||
|
@ -128,12 +129,12 @@ public class GDiffPatcher {
|
|||
break;
|
||||
int length;
|
||||
int offset;
|
||||
|
||||
|
||||
if (command <= DATA_MAX) {
|
||||
append(command, patchIS, outOS);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
switch (command) {
|
||||
case DATA_USHORT: // ushort, n bytes following; append
|
||||
length = patchIS.readUnsignedShort();
|
||||
|
@ -178,7 +179,7 @@ public class GDiffPatcher {
|
|||
length = patchIS.readInt();
|
||||
copy(loffset, length, source, outOS);
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
throw new IllegalStateException("command " + command);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue