format code: blank lines

This commit is contained in:
2015-01-18 21:32:37 +01:00
parent 6ffcca82e7
commit ade56d45a2
640 changed files with 12702 additions and 3882 deletions
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
@@ -25,7 +25,9 @@ public class ByteArrayRange {
public static final ByteArrayRange EMPTY = new ByteArrayRange(new byte[0]);
private final byte[] array;
private final int pos;
private final int length;
public ByteArrayRange(byte[] array) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.helpers;
import com.jpexs.decompiler.flash.helpers.Freed;
@@ -33,10 +34,15 @@ import java.util.WeakHashMap;
public class Cache<K, V> implements Freed {
private Map<K, V> cache;
private static final List<Cache> instances = new ArrayList<>();
public static final int STORAGE_FILES = 1;
public static final int STORAGE_MEMORY = 2;
private final boolean weak;
private final String name;
static {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.helpers;
import java.util.ArrayList;
@@ -35,7 +36,9 @@ import java.util.concurrent.TimeoutException;
public abstract class CancellableWorker<T> implements RunnableFuture<T> {
private static final ExecutorService THREAD_POOL = Executors.newCachedThreadPool();
private static List<CancellableWorker> workers = Collections.synchronizedList(new ArrayList<CancellableWorker>());
private final FutureTask<T> future;
public CancellableWorker() {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.helpers;
import com.jpexs.decompiler.flash.helpers.Freed;
@@ -42,17 +43,25 @@ import java.util.logging.Logger;
public class FileHashMap<K, V> extends AbstractMap<K, V> implements Freed {
private final Map<K, Integer> lengths = new HashMap<>();
private final Map<K, Long> offsets = new HashMap<>();
private long fileLen = 0;
private final RandomAccessFile file;
private final File fileName;
private final Set<Gap> gaps = new TreeSet<>();
private int maxGapLen = 0;
private boolean deleted = false;
private static class Gap implements Comparable<Gap> {
public long offset;
public int length;
public Gap(long offset, int length) {
@@ -86,12 +95,12 @@ public class FileHashMap<K, V> extends AbstractMap<K, V> implements Freed {
}
return true;
}
}
public static class FileEntry<K, V> implements Map.Entry<K, V> {
private final FileHashMap<K, V> parent;
private final K key;
public FileEntry(FileHashMap<K, V> parent, K key) {
@@ -113,7 +122,6 @@ public class FileHashMap<K, V> extends AbstractMap<K, V> implements Freed {
public V setValue(V value) {
return parent.put(key, value);
}
}
public FileHashMap(File file) throws IOException {
@@ -322,5 +330,4 @@ public class FileHashMap<K, V> extends AbstractMap<K, V> implements Freed {
public int size() {
return offsets.size();
}
}
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
@@ -60,6 +60,7 @@ import javax.xml.bind.DatatypeConverter;
public class Helper {
public static String newLine = System.getProperty("line.separator");
public static String decompilationErrorAdd = null;
/**
@@ -217,8 +218,8 @@ public class Helper {
}
public static String getValidHtmlId(String text) {
// ID and NAME tokens must begin with a letter ([A-Za-z]) and
// may be followed by any number of letters, digits ([0-9]),
// ID and NAME tokens must begin with a letter ([A-Za-z]) and
// may be followed by any number of letters, digits ([0-9]),
// hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
StringBuilder sb = new StringBuilder();
for (int i = 0; i < text.length(); i++) {
@@ -236,6 +237,7 @@ public class Helper {
}
private final static String SPACES12 = " ";
private final static String ZEROS8 = "00000000";
public static String formatHex(int value, int width) {
@@ -547,7 +549,9 @@ public class Helper {
}
return f;
}
private static final BitSet fileNameInvalidChars;
private static final List<String> invalidFilenamesParts;
static {
@@ -877,10 +881,10 @@ public class Helper {
sb.append(ch);
}
}
return sb.toString();
}
public static Shape imageToShape(BufferedImage image) {
Area area = new Area();
Rectangle rectangle = new Rectangle();
@@ -939,5 +943,4 @@ public class Helper {
String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp - 1) + (si ? "" : "i");
return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.helpers;
import java.io.IOException;
@@ -25,7 +26,9 @@ import java.io.InputStream;
public class LimitedInputStream extends InputStream {
private final InputStream is;
private long pos = 0;
private final long limit;
public LimitedInputStream(InputStream is, long limit) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.helpers;
import com.jpexs.helpers.streams.SeekableInputStream;
@@ -25,8 +26,11 @@ import java.io.IOException;
public class MemoryInputStream extends SeekableInputStream {
private final byte[] buffer;
private long pos;
private int startPos;
private int maxLength;
public MemoryInputStream(byte[] buffer) throws IOException {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.helpers;
import java.io.OutputStream;
@@ -26,5 +27,4 @@ public class NulStream extends OutputStream {
@Override
public void write(int i) {
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.helpers;
import java.io.IOException;
@@ -25,6 +26,7 @@ import java.io.InputStream;
public class PosMarkedInputStream extends InputStream {
private long pos = 0;
private final InputStream is;
public PosMarkedInputStream(InputStream is) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.helpers;
import com.jpexs.helpers.streams.SeekableInputStream;
@@ -27,9 +28,13 @@ import java.io.InputStream;
public class ReReadableInputStream extends SeekableInputStream {
InputStream is;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] converted;
long pos = 0;
int count = 0;
public int getCount() {
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -103,7 +103,7 @@ public class ReflectionTools {
if (!canInstantiate(cls)) {
return false;
}
try {
cls.getConstructor();
} catch (NoSuchMethodException | SecurityException ex) {
@@ -317,7 +317,7 @@ public class ReflectionTools {
}
return true;
}
public static List<Field> getSwfFields(Class cls) {
List<Field> result = new ArrayList<>();
Field[] fields = cls.getFields();
@@ -333,7 +333,7 @@ public class ReflectionTools {
result.add(f);
}
fields = cls.getDeclaredFields();
// Add private fields marked with SWFField annotation
for (Field f : fields) {
@@ -344,7 +344,7 @@ public class ReflectionTools {
if (!Modifier.isPrivate(f.getModifiers())) {
continue;
}
SWFField swfField = f.getAnnotation(SWFField.class);
if (swfField != null) {
result.add(f);
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.helpers;
import com.jpexs.decompiler.flash.helpers.ImageHelper;
@@ -38,11 +39,15 @@ import java.util.Hashtable;
public class SerializableImage implements Serializable {
public static int TYPE_INT_ARGB = BufferedImage.TYPE_INT_ARGB;
public static int TYPE_INT_RGB = BufferedImage.TYPE_INT_RGB;
public static int TYPE_INT_ARGB_PRE = BufferedImage.TYPE_INT_ARGB_PRE;
public static int TYPE_4BYTE_ABGR = BufferedImage.TYPE_4BYTE_ABGR;
private BufferedImage image;
private transient Graphics graphics;
private SerializableImage() {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.helpers;
import java.util.Date;
@@ -24,7 +25,9 @@ import java.util.Date;
public class Stopwatch {
private long startTime, elapsedTime;
private boolean running;
public Date startDate, endDate;
public static Stopwatch startNew() {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.helpers;
import java.io.IOException;
@@ -97,5 +98,4 @@ public class StreamSearch implements Searchable {
}
return ret;
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.helpers;
import java.io.IOException;
@@ -74,5 +75,4 @@ public class SwfHeaderStreamSearch implements Searchable {
}
return ret;
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.helpers.sound;
import java.io.InputStream;
@@ -42,5 +43,4 @@ public abstract class SoundPlayer {
public abstract boolean isPlaying();
public abstract long getFrameRate();
}