cleanup
This commit is contained in:
@@ -294,7 +294,8 @@ public class CachedFont implements GLFont {
|
||||
|
||||
byteBuffer = ByteBuffer.allocateDirect(width * height * (bpp / 8)).order(ByteOrder.nativeOrder()).put(newI);
|
||||
} else {
|
||||
byteBuffer = ByteBuffer.allocateDirect(width * height * (bpp / 8)).order(ByteOrder.nativeOrder()).put(((DataBufferByte) (bufferedImage.getData().getDataBuffer())).getData());
|
||||
byteBuffer = ByteBuffer.allocateDirect(width * height * (bpp / 8)).order(ByteOrder.nativeOrder())
|
||||
.put(((DataBufferByte) (bufferedImage.getData().getDataBuffer())).getData());
|
||||
}
|
||||
|
||||
byteBuffer.flip();
|
||||
@@ -411,7 +412,8 @@ public class CachedFont implements GLFont {
|
||||
chtx = chars.get(charCurrent);
|
||||
|
||||
if (chtx != null) {
|
||||
drawQuad((totalwidth), 0, (totalwidth + chtx.width), (chtx.height), chtx.texPosX, chtx.texPosY, chtx.texPosX + chtx.width, chtx.texPosY + chtx.height);
|
||||
drawQuad((totalwidth), 0, (totalwidth + chtx.width), (chtx.height), chtx.texPosX, chtx.texPosY, chtx.texPosX + chtx.width, chtx.texPosY
|
||||
+ chtx.height);
|
||||
totalwidth += chtx.width;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ public class DeferredFont extends DeferredResource implements GLFont {
|
||||
*/
|
||||
protected Font getAwtFont(String resource, float size, int style) throws FontFormatException, IOException
|
||||
{
|
||||
try (InputStream in = FileUtils.getResource(resource)) {
|
||||
try(InputStream in = FileUtils.getResource(resource)) {
|
||||
|
||||
Font awtFont = Font.createFont(Font.TRUETYPE_FONT, in);
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@ public class TestCoords {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
{
|
||||
VectVar a = Vect.makeVar();
|
||||
VectVar b = Vect.makeVar();
|
||||
final VectVar a = Vect.makeVar();
|
||||
final VectVar b = Vect.makeVar();
|
||||
|
||||
Vect cross = a.cross(b);
|
||||
Num dot = a.dot(b);
|
||||
Vect sum = a.add(b);
|
||||
Num dist = a.dist(b);
|
||||
final Vect cross = a.cross(b);
|
||||
final Num dot = a.dot(b);
|
||||
final Vect sum = a.add(b);
|
||||
final Num dist = a.dist(b);
|
||||
|
||||
a.setTo(0, 10, 0);
|
||||
b.setTo(0, 6, 7);
|
||||
@@ -32,7 +32,7 @@ public class TestCoords {
|
||||
}
|
||||
|
||||
{
|
||||
NumVar a = Num.makeVar();
|
||||
final NumVar a = Num.makeVar();
|
||||
|
||||
Num end = a;
|
||||
|
||||
|
||||
@@ -10,16 +10,16 @@ public class TestVec {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
VectVar a = Vect.makeVar(-100, 12, 6);
|
||||
final VectVar a = Vect.makeVar(-100, 12, 6);
|
||||
|
||||
VectConst b = a.freeze();
|
||||
final VectConst b = a.freeze();
|
||||
|
||||
a.setTo(400, 400, 300);
|
||||
|
||||
System.out.println(a);
|
||||
System.out.println(b);
|
||||
|
||||
Vect c = a.abs().neg();
|
||||
final Vect c = a.abs().neg();
|
||||
|
||||
System.out.println(c);
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ public class PropertyManager {
|
||||
}
|
||||
}
|
||||
|
||||
try (FileInputStream fis = new FileInputStream(file)) {
|
||||
try(FileInputStream fis = new FileInputStream(file)) {
|
||||
props.load(fis);
|
||||
} catch (final IOException e) {
|
||||
needsSave = true;
|
||||
|
||||
@@ -72,9 +72,11 @@ public class FileTreeDiff {
|
||||
ck1.reset();
|
||||
ck2.reset();
|
||||
|
||||
try (FileInputStream in1 = new FileInputStream(pair.a); FileInputStream in2 = new FileInputStream(pair.b)) {
|
||||
try(FileInputStream in1 = new FileInputStream(pair.a);
|
||||
FileInputStream in2 = new FileInputStream(pair.b)) {
|
||||
|
||||
try (CheckedInputStream cin1 = new CheckedInputStream(in1, ck1); CheckedInputStream cin2 = new CheckedInputStream(in2, ck2)) {
|
||||
try(CheckedInputStream cin1 = new CheckedInputStream(in1, ck1);
|
||||
CheckedInputStream cin2 = new CheckedInputStream(in2, ck2)) {
|
||||
|
||||
while (true) {
|
||||
final int read1 = cin1.read(BUFFER);
|
||||
|
||||
@@ -95,7 +95,8 @@ public class FileUtils {
|
||||
public static void copyFile(File source, File target) throws IOException
|
||||
{
|
||||
|
||||
try (InputStream in = new FileInputStream(source); OutputStream out = new FileOutputStream(target)) {
|
||||
try(InputStream in = new FileInputStream(source);
|
||||
OutputStream out = new FileOutputStream(target)) {
|
||||
|
||||
copyStream(in, out);
|
||||
}
|
||||
@@ -160,7 +161,7 @@ public class FileUtils {
|
||||
*/
|
||||
public static String fileToString(File file) throws IOException
|
||||
{
|
||||
try (FileInputStream fin = new FileInputStream(file)) {
|
||||
try(FileInputStream fin = new FileInputStream(file)) {
|
||||
|
||||
return streamToString(fin);
|
||||
}
|
||||
@@ -360,7 +361,7 @@ public class FileUtils {
|
||||
*/
|
||||
public static void stringToFile(File file, String text) throws IOException
|
||||
{
|
||||
try (PrintStream out = new PrintStream(new FileOutputStream(file), false, "UTF-8")) {
|
||||
try(PrintStream out = new PrintStream(new FileOutputStream(file), false, "UTF-8")) {
|
||||
|
||||
out.print(text);
|
||||
|
||||
@@ -481,7 +482,8 @@ public class FileUtils {
|
||||
*/
|
||||
public static void resourceToFile(String resname, File file) throws IOException
|
||||
{
|
||||
try (InputStream in = FileUtils.getResource(resname); OutputStream out = new FileOutputStream(file)) {
|
||||
try(InputStream in = FileUtils.getResource(resname);
|
||||
OutputStream out = new FileOutputStream(file)) {
|
||||
|
||||
FileUtils.copyStream(in, out);
|
||||
}
|
||||
@@ -498,7 +500,7 @@ public class FileUtils {
|
||||
*/
|
||||
public static String resourceToString(String resname) throws IOException
|
||||
{
|
||||
try (InputStream in = FileUtils.getResource(resname)) {
|
||||
try(InputStream in = FileUtils.getResource(resname)) {
|
||||
return streamToString(in);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class ZipBuilder {
|
||||
|
||||
out.putNextEntry(new ZipEntry(path));
|
||||
|
||||
try (InputStream in = FileUtils.stringToStream(text)) {
|
||||
try(InputStream in = FileUtils.stringToStream(text)) {
|
||||
FileUtils.copyStream(in, out);
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public class ZipBuilder {
|
||||
|
||||
out.putNextEntry(new ZipEntry(path));
|
||||
|
||||
try (InputStream in = FileUtils.getResource(resPath)) {
|
||||
try(InputStream in = FileUtils.getResource(resPath)) {
|
||||
FileUtils.copyStream(in, out);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class ZipUtils {
|
||||
*/
|
||||
public static List<String> extractZip(File file, File outputDir, StringFilter filter) throws IOException
|
||||
{
|
||||
try (ZipFile zip = new ZipFile(file)) {
|
||||
try(ZipFile zip = new ZipFile(file)) {
|
||||
return extractZip(zip, outputDir, filter);
|
||||
}
|
||||
}
|
||||
@@ -89,7 +89,7 @@ public class ZipUtils {
|
||||
*/
|
||||
public static List<String> listZip(File zipFile) throws IOException
|
||||
{
|
||||
try (ZipFile zip = new ZipFile(zipFile)) {
|
||||
try(ZipFile zip = new ZipFile(zipFile)) {
|
||||
return listZip(zip);
|
||||
}
|
||||
}
|
||||
@@ -133,7 +133,10 @@ public class ZipUtils {
|
||||
{
|
||||
if (!destFile.getParentFile().mkdirs()) throw new IOException("Could not create output directory.");
|
||||
|
||||
try (InputStream in = zip.getInputStream(entry); BufferedInputStream is = new BufferedInputStream(in); FileOutputStream fos = new FileOutputStream(destFile); BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER_SIZE)) {
|
||||
try(InputStream in = zip.getInputStream(entry);
|
||||
BufferedInputStream is = new BufferedInputStream(in);
|
||||
FileOutputStream fos = new FileOutputStream(destFile);
|
||||
BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER_SIZE)) {
|
||||
|
||||
FileUtils.copyStream(is, dest);
|
||||
}
|
||||
@@ -167,7 +170,7 @@ public class ZipUtils {
|
||||
|
||||
public static boolean entryExists(File selectedFile, String string)
|
||||
{
|
||||
try (ZipFile zf = new ZipFile(selectedFile)) {
|
||||
try(ZipFile zf = new ZipFile(selectedFile)) {
|
||||
return zf.getEntry(string) != null;
|
||||
} catch (final IOException | RuntimeException e) {
|
||||
Log.w("Error reading zip.", e);
|
||||
|
||||
@@ -67,7 +67,7 @@ public class Ion {
|
||||
*/
|
||||
public static Object fromFile(File file) throws IonException
|
||||
{
|
||||
try (InputStream in = new FileInputStream(file)) {
|
||||
try(InputStream in = new FileInputStream(file)) {
|
||||
|
||||
final Object obj = fromStream(in);
|
||||
return obj;
|
||||
@@ -113,7 +113,7 @@ public class Ion {
|
||||
*/
|
||||
public static void toFile(File path, Object obj) throws IonException
|
||||
{
|
||||
try (OutputStream out = new FileOutputStream(path)) {
|
||||
try(OutputStream out = new FileOutputStream(path)) {
|
||||
final String f = path.toString();
|
||||
final File dir = new File(f.substring(0, f.lastIndexOf(File.separator)));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user