aboutsummaryrefslogtreecommitdiffstats
path: root/ardor3d-savable
diff options
context:
space:
mode:
Diffstat (limited to 'ardor3d-savable')
-rw-r--r--ardor3d-savable/.settings/org.eclipse.jdt.ui.prefs2
-rw-r--r--ardor3d-savable/build.gradle2
-rw-r--r--ardor3d-savable/src/main/java/com/ardor3d/util/export/Ardor3dExporter.java2
-rw-r--r--ardor3d-savable/src/main/java/com/ardor3d/util/export/Ardor3dImporter.java2
-rw-r--r--ardor3d-savable/src/main/java/com/ardor3d/util/export/ByteUtils.java82
-rw-r--r--ardor3d-savable/src/main/java/com/ardor3d/util/export/CapsuleUtils.java2
-rw-r--r--ardor3d-savable/src/main/java/com/ardor3d/util/export/InputCapsule.java2
-rw-r--r--ardor3d-savable/src/main/java/com/ardor3d/util/export/OutputCapsule.java2
-rw-r--r--ardor3d-savable/src/main/java/com/ardor3d/util/export/ReadListener.java2
-rw-r--r--ardor3d-savable/src/main/java/com/ardor3d/util/export/Savable.java2
10 files changed, 50 insertions, 50 deletions
diff --git a/ardor3d-savable/.settings/org.eclipse.jdt.ui.prefs b/ardor3d-savable/.settings/org.eclipse.jdt.ui.prefs
index 681065b..8dc21f4 100644
--- a/ardor3d-savable/.settings/org.eclipse.jdt.ui.prefs
+++ b/ardor3d-savable/.settings/org.eclipse.jdt.ui.prefs
@@ -84,7 +84,7 @@ sp_cleanup.make_private_fields_final=true
sp_cleanup.make_type_abstract_if_missing_method=false
sp_cleanup.make_variable_declarations_final=true
sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.never_use_parentheses_in_expressions=false
sp_cleanup.on_save_use_additional_actions=true
sp_cleanup.organize_imports=true
sp_cleanup.qualify_static_field_accesses_with_declaring_class=true
diff --git a/ardor3d-savable/build.gradle b/ardor3d-savable/build.gradle
new file mode 100644
index 0000000..dfc3dba
--- /dev/null
+++ b/ardor3d-savable/build.gradle
@@ -0,0 +1,2 @@
+
+description = 'Ardor 3D Savable'
diff --git a/ardor3d-savable/src/main/java/com/ardor3d/util/export/Ardor3dExporter.java b/ardor3d-savable/src/main/java/com/ardor3d/util/export/Ardor3dExporter.java
index 495bf6f..bd40c21 100644
--- a/ardor3d-savable/src/main/java/com/ardor3d/util/export/Ardor3dExporter.java
+++ b/ardor3d-savable/src/main/java/com/ardor3d/util/export/Ardor3dExporter.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-savable/src/main/java/com/ardor3d/util/export/Ardor3dImporter.java b/ardor3d-savable/src/main/java/com/ardor3d/util/export/Ardor3dImporter.java
index 12a4277..747b5f1 100644
--- a/ardor3d-savable/src/main/java/com/ardor3d/util/export/Ardor3dImporter.java
+++ b/ardor3d-savable/src/main/java/com/ardor3d/util/export/Ardor3dImporter.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-savable/src/main/java/com/ardor3d/util/export/ByteUtils.java b/ardor3d-savable/src/main/java/com/ardor3d/util/export/ByteUtils.java
index 1c32f12..1380128 100644
--- a/ardor3d-savable/src/main/java/com/ardor3d/util/export/ByteUtils.java
+++ b/ardor3d-savable/src/main/java/com/ardor3d/util/export/ByteUtils.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -22,7 +22,7 @@ public abstract class ByteUtils {
/**
* Takes an InputStream and returns the complete byte content of it
- *
+ *
* @param inputStream
* The input stream to read from
* @return The byte array containing the data from the input stream
@@ -30,30 +30,28 @@ public abstract class ByteUtils {
* thrown if there is a problem reading from the input stream provided
*/
public static byte[] getByteContent(final InputStream inputStream) throws IOException {
- final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(16 * 1024);
- final byte[] buffer = new byte[1024];
- int byteCount = -1;
- byte[] data = null;
-
- // Read the byte content into the output stream first
- while ((byteCount = inputStream.read(buffer)) > 0) {
- outputStream.write(buffer, 0, byteCount);
- }
-
- // Set data with byte content from stream
- data = outputStream.toByteArray();
+ try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(16 * 1024)) {
+ final byte[] buffer = new byte[1024];
+ int byteCount = -1;
+ byte[] data = null;
+
+ // Read the byte content into the output stream first
+ while ((byteCount = inputStream.read(buffer)) > 0) {
+ outputStream.write(buffer, 0, byteCount);
+ }
- // Release resources
- outputStream.close();
+ // Set data with byte content from stream
+ data = outputStream.toByteArray();
- return data;
+ return data;
+ }
}
// ********** byte <> short METHODS **********
/**
* Writes a short out to an OutputStream.
- *
+ *
* @param outputStream
* The OutputStream the short will be written to
* @param value
@@ -79,7 +77,7 @@ public abstract class ByteUtils {
/**
* Read in a short from an InputStream
- *
+ *
* @param inputStream
* The InputStream used to read the short
* @return A short, which is the next 2 bytes converted from the InputStream
@@ -111,7 +109,7 @@ public abstract class ByteUtils {
/**
* Writes an integer out to an OutputStream.
- *
+ *
* @param outputStream
* The OutputStream the integer will be written to
* @param integer
@@ -139,7 +137,7 @@ public abstract class ByteUtils {
/**
* Read in an integer from an InputStream
- *
+ *
* @param inputStream
* The InputStream used to read the integer
* @return An int, which is the next 4 bytes converted from the InputStream
@@ -172,7 +170,7 @@ public abstract class ByteUtils {
/**
* Writes a long out to an OutputStream.
- *
+ *
* @param outputStream
* The OutputStream the long will be written to
* @param value
@@ -191,28 +189,28 @@ public abstract class ByteUtils {
public static byte[] convertToBytes(long n) {
final byte[] bytes = new byte[8];
- bytes[7] = (byte) (n);
+ bytes[7] = (byte) n;
n >>>= 8;
- bytes[6] = (byte) (n);
+ bytes[6] = (byte) n;
n >>>= 8;
- bytes[5] = (byte) (n);
+ bytes[5] = (byte) n;
n >>>= 8;
- bytes[4] = (byte) (n);
+ bytes[4] = (byte) n;
n >>>= 8;
- bytes[3] = (byte) (n);
+ bytes[3] = (byte) n;
n >>>= 8;
- bytes[2] = (byte) (n);
+ bytes[2] = (byte) n;
n >>>= 8;
- bytes[1] = (byte) (n);
+ bytes[1] = (byte) n;
n >>>= 8;
- bytes[0] = (byte) (n);
+ bytes[0] = (byte) n;
return bytes;
}
/**
* Read in a long from an InputStream
- *
+ *
* @param inputStream
* The InputStream used to read the long
* @return A long, which is the next 8 bytes converted from the InputStream
@@ -236,17 +234,17 @@ public abstract class ByteUtils {
public static long convertLongFromBytes(final byte[] bytes, final int offset) {
// Convert it to an long
- return ((((long) bytes[offset + 7]) & 0xFF) + ((((long) bytes[offset + 6]) & 0xFF) << 8)
- + ((((long) bytes[offset + 5]) & 0xFF) << 16) + ((((long) bytes[offset + 4]) & 0xFF) << 24)
- + ((((long) bytes[offset + 3]) & 0xFF) << 32) + ((((long) bytes[offset + 2]) & 0xFF) << 40)
- + ((((long) bytes[offset + 1]) & 0xFF) << 48) + ((((long) bytes[offset + 0]) & 0xFF) << 56));
+ return ((long) bytes[offset + 7] & 0xFF) + (((long) bytes[offset + 6] & 0xFF) << 8)
+ + (((long) bytes[offset + 5] & 0xFF) << 16) + (((long) bytes[offset + 4] & 0xFF) << 24)
+ + (((long) bytes[offset + 3] & 0xFF) << 32) + (((long) bytes[offset + 2] & 0xFF) << 40)
+ + (((long) bytes[offset + 1] & 0xFF) << 48) + (((long) bytes[offset + 0] & 0xFF) << 56);
}
// ********** byte <> double METHODS **********
/**
* Writes a double out to an OutputStream.
- *
+ *
* @param outputStream
* The OutputStream the double will be written to
* @param value
@@ -269,7 +267,7 @@ public abstract class ByteUtils {
/**
* Read in a double from an InputStream
- *
+ *
* @param inputStream
* The InputStream used to read the double
* @return A double, which is the next 8 bytes converted from the InputStream
@@ -301,7 +299,7 @@ public abstract class ByteUtils {
/**
* Writes an float out to an OutputStream.
- *
+ *
* @param outputStream
* The OutputStream the float will be written to
* @param fVal
@@ -324,7 +322,7 @@ public abstract class ByteUtils {
/**
* Read in a float from an InputStream
- *
+ *
* @param inputStream
* The InputStream used to read the float
* @return A float, which is the next 4 bytes converted from the InputStream
@@ -356,7 +354,7 @@ public abstract class ByteUtils {
/**
* Writes a boolean out to an OutputStream.
- *
+ *
* @param outputStream
* The OutputStream the boolean will be written to
* @param bVal
@@ -380,7 +378,7 @@ public abstract class ByteUtils {
/**
* Read in a boolean from an InputStream
- *
+ *
* @param inputStream
* The InputStream used to read the boolean
* @return A boolean, which is the next byte converted from the InputStream (iow, byte != 0)
diff --git a/ardor3d-savable/src/main/java/com/ardor3d/util/export/CapsuleUtils.java b/ardor3d-savable/src/main/java/com/ardor3d/util/export/CapsuleUtils.java
index 1d3cc35..9b90aab 100644
--- a/ardor3d-savable/src/main/java/com/ardor3d/util/export/CapsuleUtils.java
+++ b/ardor3d-savable/src/main/java/com/ardor3d/util/export/CapsuleUtils.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-savable/src/main/java/com/ardor3d/util/export/InputCapsule.java b/ardor3d-savable/src/main/java/com/ardor3d/util/export/InputCapsule.java
index 8dd51b1..abbd113 100644
--- a/ardor3d-savable/src/main/java/com/ardor3d/util/export/InputCapsule.java
+++ b/ardor3d-savable/src/main/java/com/ardor3d/util/export/InputCapsule.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-savable/src/main/java/com/ardor3d/util/export/OutputCapsule.java b/ardor3d-savable/src/main/java/com/ardor3d/util/export/OutputCapsule.java
index 226bc40..67c79d0 100644
--- a/ardor3d-savable/src/main/java/com/ardor3d/util/export/OutputCapsule.java
+++ b/ardor3d-savable/src/main/java/com/ardor3d/util/export/OutputCapsule.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-savable/src/main/java/com/ardor3d/util/export/ReadListener.java b/ardor3d-savable/src/main/java/com/ardor3d/util/export/ReadListener.java
index ec9b724..b7c2411 100644
--- a/ardor3d-savable/src/main/java/com/ardor3d/util/export/ReadListener.java
+++ b/ardor3d-savable/src/main/java/com/ardor3d/util/export/ReadListener.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-savable/src/main/java/com/ardor3d/util/export/Savable.java b/ardor3d-savable/src/main/java/com/ardor3d/util/export/Savable.java
index d021554..9e3f34f 100644
--- a/ardor3d-savable/src/main/java/com/ardor3d/util/export/Savable.java
+++ b/ardor3d-savable/src/main/java/com/ardor3d/util/export/Savable.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*