reconstruct code && add advice for out of memory error.
This commit is contained in:
@@ -22,7 +22,7 @@ import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public final class C {
|
||||
public static final Gson gsonPrettyPrinting = new GsonBuilder().setPrettyPrinting().create();
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jackhuang.hellominecraft.logging.logger.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class HMCLog {
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.jackhuang.hellominecraft.logging.layout.DefaultLayout;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
|
||||
public class Configuration {
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.logging;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public enum Level {
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.jackhuang.hellominecraft.logging.message.IMessage;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class LogEvent {
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.logging;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class LoggingException extends RuntimeException {
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jackhuang.hellominecraft.logging.layout.ILayout;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public abstract class AbstractAppender implements IAppender {
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.jackhuang.hellominecraft.logging.layout.ILayout;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class ConsoleAppender extends OutputStreamAppender {
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jackhuang.hellominecraft.logging.layout.ILayout;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public interface IAppender {
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.jackhuang.hellominecraft.logging.layout.ILayout;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public abstract class OutputStreamAppender extends AbstractAppender {
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.jackhuang.hellominecraft.logging.LogEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public abstract class AbstractStringLayout implements ILayout<String> {
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jackhuang.hellominecraft.logging.LogEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class DefaultLayout extends AbstractStringLayout {
|
||||
private static final SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jackhuang.hellominecraft.logging.LogEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
* @param <T>
|
||||
*/
|
||||
public interface ILayout<T extends Serializable> {
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jackhuang.hellominecraft.logging.message.IMessage;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public interface ILogger {
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.logging.message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public abstract class AbstractMessageFactory
|
||||
implements IMessageFactory {
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public interface IMessage extends Serializable {
|
||||
String getFormattedMessage();
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.logging.message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public abstract interface IMessageFactory {
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class ParameterizedMessage
|
||||
implements IMessage {
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.logging.message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public final class ParameterizedMessageFactory extends AbstractMessageFactory {
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.logging.message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class SimpleMessage
|
||||
implements IMessage {
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.tasks;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public interface DoingDoneListener<K> {
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.tasks;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public abstract class ProgressProvider {
|
||||
protected ProgressProviderListener ppl;
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.tasks;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public interface ProgressProviderListener {
|
||||
void setProgress(int prog, int max);
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.Collection;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public abstract class Task extends ProgressProvider {
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.tasks;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public abstract class TaskInfo extends Task {
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jackhuang.hellominecraft.HMCLog;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class TaskList extends Thread {
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.tasks;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class TaskRunnable extends TaskInfo {
|
||||
private final Runnable r;
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.jackhuang.hellominecraft.utils.functions.Consumer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
* @param <T> Runnable<T>
|
||||
*/
|
||||
public class TaskRunnableArg1<T> extends TaskInfo implements PreviousResultRegistrator<T> {
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jackhuang.hellominecraft.utils.SwingUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class TaskWindow extends javax.swing.JDialog
|
||||
implements ProgressProviderListener, NonConsumer, DoingDoneListener<Task> {
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.tasks.communication;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
* @param <T> Task result type
|
||||
*/
|
||||
public interface PreviousResult<T> {
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.jackhuang.hellominecraft.tasks.Task;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
* @param <T> Previous task result type
|
||||
*/
|
||||
public interface PreviousResultRegistrator<T> {
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jackhuang.hellominecraft.views.LogWindow;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class ContentGetAndShowTask extends HTTPGetTask implements Event<String> {
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.jackhuang.hellominecraft.tasks.ProgressProviderListener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public interface DownloadListener extends ProgressProviderListener {
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ import org.jackhuang.hellominecraft.utils.system.IOUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
// This class downloads a file from a URL.
|
||||
public class FileDownloadTask extends Task implements PreviousResult<File>, PreviousResultRegistrator<String> {
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jackhuang.hellominecraft.utils.EventHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class HTTPGetTask extends TaskInfo implements PreviousResult<String> {
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.tasks.download;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class NetException extends RuntimeException {
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class ArrayUtils {
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.Iterator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public final class CollectionUtils {
|
||||
public static <T> void forEach(Collection<T> coll, Consumer<T> p) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class DoubleOutputStream extends OutputStream {
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class LauncherPrintStream extends PrintStream {
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
* @param <K> K Type
|
||||
* @param <V> V Type
|
||||
*/
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class ReflectUtils {
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import javax.swing.text.JTextComponent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class TextComponentOutputStream extends OutputStream {
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.jackhuang.hellominecraft.HMCLog;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public final class UpdateChecker extends Thread {
|
||||
public static boolean OUT_DATED = false;
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.jackhuang.hellominecraft.C;
|
||||
import org.jackhuang.hellominecraft.HMCLog;
|
||||
|
||||
/**
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public final class Utils {
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.jackhuang.hellominecraft.HMCLog;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public final class VersionNumber implements Comparable<VersionNumber> {
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.io.UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class Base64 {
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.security.NoSuchAlgorithmException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class DigestUtils {
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.jackhuang.hellominecraft.utils.functions;
|
||||
|
||||
/**
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public interface BiConsumer<V, V2> {
|
||||
void onDone(V value, V2 value2);
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.utils.functions;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class FalseFunction implements NonFunction<Boolean> {
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.utils.functions;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public interface NonConsumer {
|
||||
void onDone();
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.utils.functions;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public interface NonFunction<T> {
|
||||
T onDone();
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.utils.functions;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public interface Predicate<T> {
|
||||
boolean apply(T t);
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.utils.functions;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public interface TriConsumer<V1, V2, V3> {
|
||||
void onDone(V1 v1, V2 v2, V3 v3);
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.utils.functions;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class TrueFunction implements NonFunction<Boolean> {
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.jackhuang.hellominecraft.utils.StrUtils;
|
||||
/**
|
||||
* 文件压缩/解压类
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class Compressor {
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.jackhuang.hellominecraft.utils.NetUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class FileUtils {
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class JavaProcess {
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.utils.system;
|
||||
|
||||
import org.jackhuang.hellominecraft.utils.system.Platform;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -29,7 +28,7 @@ import org.jackhuang.hellominecraft.utils.StrUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public final class JdkVersion {
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import javax.swing.JOptionPane;
|
||||
import org.jackhuang.hellominecraft.C;
|
||||
|
||||
/**
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class MessageBox
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.lang.management.ManagementFactory;
|
||||
import org.jackhuang.hellominecraft.HMCLog;
|
||||
|
||||
/**
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public enum OS {
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jackhuang.hellominecraft.utils.EventHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class ProcessThread extends Thread {
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.version;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class MinecraftRemoteLatestVersion {
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.version;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class MinecraftRemoteVersion {
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jackhuang.hellominecraft.C;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class MinecraftRemoteVersions {
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.jackhuang.hellominecraft.version;
|
||||
import org.jackhuang.hellominecraft.C;
|
||||
|
||||
/**
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class MinecraftVersionRequest {
|
||||
public static final int Unkown = 0, Invaild = 1, InvaildJar = 2,
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.awt.Color;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class BasicColors {
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jackhuang.hellominecraft.utils.Utils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class LogWindow extends javax.swing.JFrame {
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jackhuang.hellominecraft.views;
|
||||
|
||||
/**
|
||||
* The frame given to choose things.
|
||||
* @author hyh
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class Selector extends javax.swing.JDialog {
|
||||
String[] selList;
|
||||
|
||||
Reference in New Issue
Block a user