diff --git a/Dorkbox-Util/LICENSE b/Dorkbox-Util/LICENSE new file mode 100644 index 0000000..8c70a31 --- /dev/null +++ b/Dorkbox-Util/LICENSE @@ -0,0 +1,92 @@ + + - Copyright (c) 2010 and beyond, dorkbox llc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + THIS SOFTWARE IS NOT DESIGNED OR INTENDED FOR USE OR RESALE AS + ON-LINE CONTROL EQUIPMENT IN HAZARDOUS ENVIRONMENTS REQUIRING FAIL-SAFE + PERFORMANCE, SUCH AS IN THE OPERATION OF NUCLEAR FACILITIES, AIRCRAFT + NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, DIRECT LIFE + SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH THE FAILURE OF THE SOFTWARE + COULD LEAD DIRECTLY TO DEATH, PERSONAL INJURY, OR SEVERE PHYSICAL OR + ENVIRONMENTAL DAMAGE ("HIGH RISK ACTIVITIES"). + + + + + - BinarySearch - MIT License + https://github.com/timboudreau/util + Copyright 2013 Tim Boudreau + + + + - BouncyCastle - MIT X11 License + http://www.bouncycastle.org + Copyright 2000 - 2009 The Legion Of The Bouncy Castle + + + + - ConcurrentHashMapV8 - CC0 License + Written by Doug Lea with assistance from members of JCP JSR-166 + Expert Group and released to the public domain, as explained at + http://creativecommons.org/publicdomain/zero/1.0/ + + + + - FastObjectPool - Apache 2.0 License + http://ashkrit.blogspot.com/2013/05/lock-less-java-object-pool.html + https://github.com/ashkrit/blog/tree/master/FastObjectPool + Copyright 2013 Ashkrit + + + + - FilenameUtils.java (normalize + dependencies) - Apache 2.0 License + http://commons.apache.org/proper/commons-io/ + Copyright 2013 ASF + Authors: Kevin A. Burton, Scott Sanders, Daniel Rall, Christoph.Reck, + Peter Donald, Jeff Turner, Matthew Hawthorne, Martin Cooper, + Jeremias Maerki, Stephen Colebourne + + + + - JNA - Apache 2.0 License + https://github.com/twall/jna + Copyright (c) 2011 Timothy Wall + + + + - Kryo - New BSD License + https://github.com/EsotericSoftware/kryo + Copyright 2008, Nathan Sweet, All rights reserved. + + + + - LAN HostDiscovery from Apache Commons JCS - Apache 2.0 License + https://issues.apache.org/jira/browse/JCS-40 + Copyright 2001-2014 The Apache Software Foundation. + + + + - MathUtils, IntArray, IntMap - Apache 2.0 License + http://github.com/libgdx/libgdx/ + Copyright 2013 + Mario Zechner + Nathan Sweet + + + + - MersenneTwisterFast, v20 - BSD License + http://www.cs.gmu.edu/~sean/research/mersenne/MersenneTwisterFast.java + Copyright 2003 by Sean Luke + Portions copyright 1993 by Michael Lecuyer diff --git a/Dorkbox-Util/LICENSE.TXT b/Dorkbox-Util/LICENSE.TXT deleted file mode 100644 index 6611757..0000000 --- a/Dorkbox-Util/LICENSE.TXT +++ /dev/null @@ -1,135 +0,0 @@ -Legal: - - - - - Copyright (c) 2010 and beyond, dorkbox llc. All rights reserved. - - This software is a commercial product. Use, redistribution, and - modification without a license is NOT permitted. Contact - license@dorkbox.com for a license. - - Neither the name of dorkbox, dorkbox llc, or dorkbox.com or the names of - its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - THE POSSIBILITY OF SUCH DAMAGE. - - THIS SOFTWARE IS NOT DESIGNED OR INTENDED FOR USE OR RESALE AS - ON-LINE CONTROL EQUIPMENT IN HAZARDOUS ENVIRONMENTS REQUIRING FAIL-SAFE - PERFORMANCE, SUCH AS IN THE OPERATION OF NUCLEAR FACILITIES, AIRCRAFT - NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, DIRECT LIFE - SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH THE FAILURE OF THE SOFTWARE - COULD LEAD DIRECTLY TO DEATH, PERSONAL INJURY, OR SEVERE PHYSICAL OR - ENVIRONMENTAL DAMAGE ("HIGH RISK ACTIVITIES"). - - THIS AGREEMENT IS GOVERNED THE INTELLECTUAL PROPERTY LAWS OF THE UNITED - STATES OF AMERICA. NO PARTY TO THIS AGREEMENT WILL BRING A LEGAL ACTION - UNDER THIS AGREEMENT MORE THAN ONE YEAR AFTER THE CAUSE OF ACTION AROSE. - EACH PARTY WAIVES ITS RIGHTS TO A JURY TRIAL IN ANY RESULTING LITIGATION. - - - - - - - - This software product uses encryption algorithms that are controlled by - the United States Export Administration Regulations (EAR). - https://bxa.ntis.gov/ - - Details of the U.S. Commercial Encryption Export Controls can be found at - the Bureau of Industry and Security (BIS) web site. - http://www.bis.doc.gov/ - - PROHIBITED END USERS - ALL products are prohibited for export/reexport to the following: - - - Any company or national of Cuba, Iran, North Korea, Sudan, and Syria. - Licenses to these countries and parties are presumed denied. - - - Re-export to these countries is prohibited; if you "know or have reason - to know" that an illegal reshipment will take place, you may not ship to - such a user. - - - Entities listed on any U.S. Government Denied Party/Person List. See BIS's - The Denied Persons List, the Office of Foreign Assets Control's Economic - and Trade sanctions list, (OFAC), and the Office of Defense Trade - Controls (DTC). - - - Any customer you know or have reason to know, who is involved in the - design, development, manufacture or production of nuclear technology, or - nuclear, biological or chemical "weapons of mass destruction." - - All products are subject to the U.S. Export Laws, and diversion contrary - to U.S. law is prohibited. - - - - - BouncyCastle - MIT X11 License - http://www.bouncycastle.org - Copyright 2000 - 2009 The Legion Of The Bouncy Castle - - - - - ConcurrentHashMapV8 - CC0 License - Written by Doug Lea with assistance from members of JCP JSR-166 - Expert Group and released to the public domain, as explained at - http://creativecommons.org/publicdomain/zero/1.0/ - - - - - FastObjectPool - Apache 2.0 License - http://ashkrit.blogspot.com/2013/05/lock-less-java-object-pool.html - https://github.com/ashkrit/blog/tree/master/FastObjectPool - Copyright 2013 Ashkrit - - - - - FilenameUtils.java (normalize + dependencies) - Apache 2.0 License - http://commons.apache.org/proper/commons-io/ - Copyright 2013 ASF - Authors: Kevin A. Burton, Scott Sanders, Daniel Rall, Christoph.Reck, - Peter Donald, Jeff Turner, Matthew Hawthorne, Martin Cooper, - Jeremias Maerki, Stephen Colebourne - - - - - JNA - Apache 2.0 License - https://github.com/twall/jna - Copyright (c) 2011 Timothy Wall - - - - - LAN HostDiscovery from Apache Commons JCS - Apache 2.0 License - https://issues.apache.org/jira/browse/JCS-40 - Copyright 2001-2014 The Apache Software Foundation. - - - - - BinarySearch - MIT License - https://github.com/timboudreau/util - Copyright 2013 Tim Boudreau - - - - - MathUtils, IntArray, IntMap - Apache 2.0 License - http://github.com/libgdx/libgdx/ - Copyright 2013 - Mario Zechner - Nathan Sweet - - - - - MersenneTwisterFast, v20 - BSD License - http://www.cs.gmu.edu/~sean/research/mersenne/MersenneTwisterFast.java - Copyright 2003 by Sean Luke - Portions copyright 1993 by Michael Lecuyer diff --git a/Dorkbox-Util/src/dorkbox/util/ClassHelper.java b/Dorkbox-Util/src/dorkbox/util/ClassHelper.java index 3b6582c..e1276c9 100644 --- a/Dorkbox-Util/src/dorkbox/util/ClassHelper.java +++ b/Dorkbox-Util/src/dorkbox/util/ClassHelper.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util; import java.lang.reflect.Array; diff --git a/Dorkbox-Util/src/dorkbox/util/CountingLatch.java b/Dorkbox-Util/src/dorkbox/util/CountingLatch.java index a1f7b9f..d0155f8 100644 --- a/Dorkbox-Util/src/dorkbox/util/CountingLatch.java +++ b/Dorkbox-Util/src/dorkbox/util/CountingLatch.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util; import java.util.concurrent.TimeUnit; @@ -9,7 +24,7 @@ public class CountingLatch { * count. */ private static final class Sync extends AbstractQueuedSynchronizer { - private static final long serialVersionUID = -2911206339865903403L; + private static final long serialVersionUID = 1L; private Sync() {} diff --git a/Dorkbox-Util/src/dorkbox/util/DelayTimer.java b/Dorkbox-Util/src/dorkbox/util/DelayTimer.java index 00d0748..1ba2669 100644 --- a/Dorkbox-Util/src/dorkbox/util/DelayTimer.java +++ b/Dorkbox-Util/src/dorkbox/util/DelayTimer.java @@ -1,10 +1,23 @@ +/* + * Copyright 2010 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util; - import java.util.Timer; import java.util.TimerTask; - public class DelayTimer { public interface Callback { public void execute(); diff --git a/Dorkbox-Util/src/dorkbox/util/FileUtil.java b/Dorkbox-Util/src/dorkbox/util/FileUtil.java index b1d4b81..87a3064 100644 --- a/Dorkbox-Util/src/dorkbox/util/FileUtil.java +++ b/Dorkbox-Util/src/dorkbox/util/FileUtil.java @@ -697,6 +697,19 @@ public class FileUtil { } + /** + * Parses the specified root directory for ALL files that are in it. All of the sub-directories are searched as well. + *

+ * This is different, in that it returns ALL FILES, instead of ones that just match a specific extension. + * @return the list of all files in the root+sub-dirs. + */ + public static List parseDir(String rootDirectory) { + if (rootDirectory == null) { + throw new IllegalArgumentException("rootDirectory cannot be null"); + } + return parseDir(new File(rootDirectory), (String) null); + } + /** * Parses the specified root directory for ALL files that are in it. All of the sub-directories are searched as well. *

@@ -958,6 +971,14 @@ public class FileUtil { //----------------------------------------------------------------------- + /* + * FilenameUtils.java (normalize + dependencies) - Apache 2.0 License + * http://commons.apache.org/proper/commons-io/ + * Copyright 2013 ASF + * Authors: Kevin A. Burton, Scott Sanders, Daniel Rall, Christoph.Reck, + * Peter Donald, Jeff Turner, Matthew Hawthorne, Martin Cooper, + * Jeremias Maerki, Stephen Colebourne + */ /** * Normalizes a path, removing double and single dot path steps. *

@@ -1002,6 +1023,66 @@ public class FileUtil { return doNormalize(filename, SYSTEM_SEPARATOR, true); } + /* + * FilenameUtils.java (normalize + dependencies) - Apache 2.0 License + * http://commons.apache.org/proper/commons-io/ + * Copyright 2013 ASF + * Authors: Kevin A. Burton, Scott Sanders, Daniel Rall, Christoph.Reck, + * Peter Donald, Jeff Turner, Matthew Hawthorne, Martin Cooper, + * Jeremias Maerki, Stephen Colebourne + */ + /** + * Normalizes a path, removing double and single dot path steps. + *

+ * This method normalizes a path to a standard format. + * The input may contain separators in either Unix or Windows format. + * The output will contain separators in the format of the system. + *

+ * A trailing slash will be retained. + * A double slash will be merged to a single slash (but UNC names are handled). + * A single dot path segment will be removed. + * A double dot will cause that path segment and the one before to be removed. + * If the double dot has no parent path segment to work with, {@code null} + * is returned. + *

+ * The output will be the same on both Unix and Windows except + * for the separator character. + *

+     * /foo//               -->   /foo/
+     * /foo/./              -->   /foo/
+     * /foo/../bar          -->   /bar
+     * /foo/../bar/         -->   /bar/
+     * /foo/../bar/../baz   -->   /baz
+     * //foo//./bar         -->   /foo/bar
+     * /../                 -->   null
+     * ../foo               -->   null
+     * foo/bar/..           -->   foo/
+     * foo/../../bar        -->   null
+     * foo/../bar           -->   bar
+     * //server/foo/../bar  -->   //server/bar
+     * //server/../bar      -->   null
+     * C:\foo\..\bar        -->   C:\bar
+     * C:\..\bar            -->   null
+     * ~/foo/../bar/        -->   ~/bar/
+     * ~/../bar             -->   null
+     * 
+ * (Note the file separator returned will be correct for Windows/Unix) + * + * @param filename the filename to normalize, null returns null + * @return the normalized filename, or null if invalid + */ + public static String normalizeAsFile(String filename) { + return doNormalize(new File(filename).getAbsolutePath(), SYSTEM_SEPARATOR, true); + } + + /* + * FilenameUtils.java (normalize + dependencies) - Apache 2.0 License + * http://commons.apache.org/proper/commons-io/ + * Copyright 2013 ASF + * Authors: Kevin A. Burton, Scott Sanders, Daniel Rall, Christoph.Reck, + * Peter Donald, Jeff Turner, Matthew Hawthorne, Martin Cooper, + * Jeremias Maerki, Stephen Colebourne + */ /** * Normalizes a path, removing double and single dot path steps. *

@@ -1055,7 +1136,14 @@ public class FileUtil { return new File(asString); } - + /* + * FilenameUtils.java (normalize + dependencies) - Apache 2.0 License + * http://commons.apache.org/proper/commons-io/ + * Copyright 2013 ASF + * Authors: Kevin A. Burton, Scott Sanders, Daniel Rall, Christoph.Reck, + * Peter Donald, Jeff Turner, Matthew Hawthorne, Martin Cooper, + * Jeremias Maerki, Stephen Colebourne + */ /** * Normalizes a path, removing double and single dot path steps. *

@@ -1106,6 +1194,14 @@ public class FileUtil { } //----------------------------------------------------------------------- + /* + * FilenameUtils.java (normalize + dependencies) - Apache 2.0 License + * http://commons.apache.org/proper/commons-io/ + * Copyright 2013 ASF + * Authors: Kevin A. Burton, Scott Sanders, Daniel Rall, Christoph.Reck, + * Peter Donald, Jeff Turner, Matthew Hawthorne, Martin Cooper, + * Jeremias Maerki, Stephen Colebourne + */ /** * Normalizes a path, removing double and single dot path steps, * and removing any final directory separator. @@ -1151,6 +1247,14 @@ public class FileUtil { return doNormalize(filename, SYSTEM_SEPARATOR, false); } + /* + * FilenameUtils.java (normalize + dependencies) - Apache 2.0 License + * http://commons.apache.org/proper/commons-io/ + * Copyright 2013 ASF + * Authors: Kevin A. Burton, Scott Sanders, Daniel Rall, Christoph.Reck, + * Peter Donald, Jeff Turner, Matthew Hawthorne, Martin Cooper, + * Jeremias Maerki, Stephen Colebourne + */ /** * Normalizes a path, removing double and single dot path steps, * and removing any final directory separator. @@ -1199,6 +1303,14 @@ public class FileUtil { return doNormalize(filename, separator, false); } + /* + * FilenameUtils.java (normalize + dependencies) - Apache 2.0 License + * http://commons.apache.org/proper/commons-io/ + * Copyright 2013 ASF + * Authors: Kevin A. Burton, Scott Sanders, Daniel Rall, Christoph.Reck, + * Peter Donald, Jeff Turner, Matthew Hawthorne, Martin Cooper, + * Jeremias Maerki, Stephen Colebourne + */ /** * Internal method to perform the normalization. * @@ -1215,6 +1327,7 @@ public class FileUtil { if (size == 0) { return filename; } + int prefix = getPrefixLength(filename); if (prefix < 0) { return null; @@ -1301,6 +1414,14 @@ public class FileUtil { } //----------------------------------------------------------------------- + /* + * FilenameUtils.java (normalize + dependencies) - Apache 2.0 License + * http://commons.apache.org/proper/commons-io/ + * Copyright 2013 ASF + * Authors: Kevin A. Burton, Scott Sanders, Daniel Rall, Christoph.Reck, + * Peter Donald, Jeff Turner, Matthew Hawthorne, Martin Cooper, + * Jeremias Maerki, Stephen Colebourne + */ /** * Returns the length of the filename prefix, such as C:/ or ~/. *

@@ -1387,6 +1508,14 @@ public class FileUtil { } //----------------------------------------------------------------------- + /* + * FilenameUtils.java (normalize + dependencies) - Apache 2.0 License + * http://commons.apache.org/proper/commons-io/ + * Copyright 2013 ASF + * Authors: Kevin A. Burton, Scott Sanders, Daniel Rall, Christoph.Reck, + * Peter Donald, Jeff Turner, Matthew Hawthorne, Martin Cooper, + * Jeremias Maerki, Stephen Colebourne + */ /** * Checks if the character is a separator. * @@ -1397,6 +1526,7 @@ public class FileUtil { return ch == UNIX_SEPARATOR || ch == WINDOWS_SEPARATOR; } + /** * Gets the extension of a file */ diff --git a/Dorkbox-Util/src/dorkbox/util/Keep.java b/Dorkbox-Util/src/dorkbox/util/Keep.java index 15a4aa3..5b6b76f 100644 --- a/Dorkbox-Util/src/dorkbox/util/Keep.java +++ b/Dorkbox-Util/src/dorkbox/util/Keep.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util; import java.lang.annotation.ElementType; @@ -7,7 +22,6 @@ import java.lang.annotation.Target; /** * Marker annotation for proguard - * */ @Retention(RetentionPolicy.CLASS) @Target({ElementType.TYPE}) diff --git a/Dorkbox-Util/src/dorkbox/util/MathUtils.java b/Dorkbox-Util/src/dorkbox/util/MathUtils.java index 2613c4d..0487e04 100644 --- a/Dorkbox-Util/src/dorkbox/util/MathUtils.java +++ b/Dorkbox-Util/src/dorkbox/util/MathUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -// pruned/limited version from libGDX +// pruned/limited version from libGDX, modified by dorkbox, llc package dorkbox.util; diff --git a/Dorkbox-Util/src/dorkbox/util/NamedThreadFactory.java b/Dorkbox-Util/src/dorkbox/util/NamedThreadFactory.java index b135df6..26668e7 100644 --- a/Dorkbox-Util/src/dorkbox/util/NamedThreadFactory.java +++ b/Dorkbox-Util/src/dorkbox/util/NamedThreadFactory.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util; import java.util.concurrent.ThreadFactory; diff --git a/Dorkbox-Util/src/dorkbox/util/RegExp.java b/Dorkbox-Util/src/dorkbox/util/RegExp.java index 3f73f90..7964fbb 100644 --- a/Dorkbox-Util/src/dorkbox/util/RegExp.java +++ b/Dorkbox-Util/src/dorkbox/util/RegExp.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util; public class RegExp { diff --git a/Dorkbox-Util/src/dorkbox/util/Sys.java b/Dorkbox-Util/src/dorkbox/util/Sys.java index 8fbd7e4..9e176f2 100644 --- a/Dorkbox-Util/src/dorkbox/util/Sys.java +++ b/Dorkbox-Util/src/dorkbox/util/Sys.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util; import java.io.BufferedReader; @@ -33,13 +48,11 @@ import java.util.regex.Pattern; import org.bouncycastle.crypto.digests.SHA256Digest; -import com.esotericsoftware.kryo.util.Util; - import dorkbox.urlHandler.BoxURLConnection; public class Sys { public static final int javaVersion = getJavaVersion(); - public static final boolean isAndroid = Util.isAndroid; + public static final boolean isAndroid = getIsAndroid(); public static final sun.misc.Unsafe unsafe = getUNSAFE(); @@ -58,6 +71,15 @@ public class Sys { return charArray; } + private static boolean getIsAndroid() { + try { + Class.forName("android.os.Process"); + return true; + } catch (Exception ignored) { + return false; + } + } + private static int getJavaVersion() { String fullJavaVersion = System.getProperty("java.version"); diff --git a/Dorkbox-Util/src/dorkbox/util/bytes/ByteArrayWrapper.java b/Dorkbox-Util/src/dorkbox/util/bytes/ByteArrayWrapper.java index 1227a1f..616caa0 100644 --- a/Dorkbox-Util/src/dorkbox/util/bytes/ByteArrayWrapper.java +++ b/Dorkbox-Util/src/dorkbox/util/bytes/ByteArrayWrapper.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.bytes; import java.util.Arrays; diff --git a/Dorkbox-Util/src/dorkbox/util/bytes/ByteBuffer2.java b/Dorkbox-Util/src/dorkbox/util/bytes/ByteBuffer2.java index e5f044d..bbc76e6 100644 --- a/Dorkbox-Util/src/dorkbox/util/bytes/ByteBuffer2.java +++ b/Dorkbox-Util/src/dorkbox/util/bytes/ByteBuffer2.java @@ -1,4 +1,22 @@ - +/* + * Copyright (c) 2008, Nathan Sweet + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * * Neither the name of Esoteric Software nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Modified by dorkbox, llc + */ package dorkbox.util.bytes; import java.nio.BufferUnderflowException; @@ -12,7 +30,7 @@ import java.util.Arrays; * Encoding of integers: BIG_ENDIAN is used for storing fixed native size integer values LITTLE_ENDIAN is used for a variable * length encoding of integer values * - * @author Nathan Sweet , Nathan Robinson + * @author Nathan Sweet */ public class ByteBuffer2 { private int capacity; // exactly how many bytes have been allocated diff --git a/Dorkbox-Util/src/dorkbox/util/bytes/ByteBuffer2Poolable.java b/Dorkbox-Util/src/dorkbox/util/bytes/ByteBuffer2Poolable.java index 708515f..509bc74 100644 --- a/Dorkbox-Util/src/dorkbox/util/bytes/ByteBuffer2Poolable.java +++ b/Dorkbox-Util/src/dorkbox/util/bytes/ByteBuffer2Poolable.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.bytes; import dorkbox.util.objectPool.PoolableObject; diff --git a/Dorkbox-Util/src/dorkbox/util/bytes/LittleEndian.java b/Dorkbox-Util/src/dorkbox/util/bytes/LittleEndian.java index 5d34209..7f3fd8e 100644 --- a/Dorkbox-Util/src/dorkbox/util/bytes/LittleEndian.java +++ b/Dorkbox-Util/src/dorkbox/util/bytes/LittleEndian.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.bytes; import java.nio.ByteBuffer; diff --git a/Dorkbox-Util/src/dorkbox/util/bytes/OptimizeUtilsByteArray.java b/Dorkbox-Util/src/dorkbox/util/bytes/OptimizeUtilsByteArray.java index cc1d7e7..b1c3d3e 100644 --- a/Dorkbox-Util/src/dorkbox/util/bytes/OptimizeUtilsByteArray.java +++ b/Dorkbox-Util/src/dorkbox/util/bytes/OptimizeUtilsByteArray.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.bytes; public class OptimizeUtilsByteArray { diff --git a/Dorkbox-Util/src/dorkbox/util/bytes/OptimizeUtilsByteBuf.java b/Dorkbox-Util/src/dorkbox/util/bytes/OptimizeUtilsByteBuf.java index 7a3e77d..592c3d0 100644 --- a/Dorkbox-Util/src/dorkbox/util/bytes/OptimizeUtilsByteBuf.java +++ b/Dorkbox-Util/src/dorkbox/util/bytes/OptimizeUtilsByteBuf.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.bytes; import io.netty.buffer.ByteBuf; diff --git a/Dorkbox-Util/src/dorkbox/util/collections/IntMap.java b/Dorkbox-Util/src/dorkbox/util/collections/IntMap.java index 5b306bd..25e67bb 100644 --- a/Dorkbox-Util/src/dorkbox/util/collections/IntMap.java +++ b/Dorkbox-Util/src/dorkbox/util/collections/IntMap.java @@ -14,7 +14,7 @@ * limitations under the License. */ -// slightly tweaked from libGDX +// slightly tweaked from libGDX, by dorkbox, llc package dorkbox.util.collections; diff --git a/Dorkbox-Util/src/dorkbox/util/collections/ObjectIntMap.java b/Dorkbox-Util/src/dorkbox/util/collections/ObjectIntMap.java index 3c35848..2648b41 100644 --- a/Dorkbox-Util/src/dorkbox/util/collections/ObjectIntMap.java +++ b/Dorkbox-Util/src/dorkbox/util/collections/ObjectIntMap.java @@ -1,4 +1,18 @@ - +/******************************************************************************* + * Copyright 2011 See AUTHORS file. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.collections; import com.esotericsoftware.kryo.util.ObjectMap; diff --git a/Dorkbox-Util/src/dorkbox/util/objectPool/FastObjectPool.java b/Dorkbox-Util/src/dorkbox/util/objectPool/FastObjectPool.java index 6dd1e6d..3a3de27 100644 --- a/Dorkbox-Util/src/dorkbox/util/objectPool/FastObjectPool.java +++ b/Dorkbox-Util/src/dorkbox/util/objectPool/FastObjectPool.java @@ -1,7 +1,4 @@ -package dorkbox.util.objectPool; - /* - * * from: http://ashkrit.blogspot.de/2013/05/lock-less-java-object-pool.html * https://github.com/ashkrit/blog/tree/master/FastObjectPool * copyright ashkrit 2013 @@ -17,7 +14,10 @@ package dorkbox.util.objectPool; * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Modified by dorkbox, llc */ +package dorkbox.util.objectPool; import java.util.concurrent.locks.ReentrantLock; diff --git a/Dorkbox-Util/src/dorkbox/util/objectPool/ObjectPool.java b/Dorkbox-Util/src/dorkbox/util/objectPool/ObjectPool.java index f7702b2..faf5f8f 100644 --- a/Dorkbox-Util/src/dorkbox/util/objectPool/ObjectPool.java +++ b/Dorkbox-Util/src/dorkbox/util/objectPool/ObjectPool.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.objectPool; public interface ObjectPool { diff --git a/Dorkbox-Util/src/dorkbox/util/objectPool/ObjectPoolFactory.java b/Dorkbox-Util/src/dorkbox/util/objectPool/ObjectPoolFactory.java index 4f25a2d..647c1ca 100644 --- a/Dorkbox-Util/src/dorkbox/util/objectPool/ObjectPoolFactory.java +++ b/Dorkbox-Util/src/dorkbox/util/objectPool/ObjectPoolFactory.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.objectPool; import dorkbox.util.Sys; diff --git a/Dorkbox-Util/src/dorkbox/util/objectPool/ObjectPoolHolder.java b/Dorkbox-Util/src/dorkbox/util/objectPool/ObjectPoolHolder.java index 0ce124f..80e6fef 100644 --- a/Dorkbox-Util/src/dorkbox/util/objectPool/ObjectPoolHolder.java +++ b/Dorkbox-Util/src/dorkbox/util/objectPool/ObjectPoolHolder.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.objectPool; import java.util.concurrent.atomic.AtomicBoolean; @@ -7,7 +22,6 @@ public class ObjectPoolHolder { AtomicBoolean state = new AtomicBoolean(true); - public ObjectPoolHolder(T value) { this.value = value; } diff --git a/Dorkbox-Util/src/dorkbox/util/objectPool/PoolableObject.java b/Dorkbox-Util/src/dorkbox/util/objectPool/PoolableObject.java index 13002c0..019e936 100644 --- a/Dorkbox-Util/src/dorkbox/util/objectPool/PoolableObject.java +++ b/Dorkbox-Util/src/dorkbox/util/objectPool/PoolableObject.java @@ -1,19 +1,33 @@ +/* + * Copyright 2014 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.objectPool; - public interface PoolableObject { /** - * called when a new instance is created - */ + * called when a new instance is created + */ public T create(); /** - * invoked on every instance that is borrowed from the pool - */ + * invoked on every instance that is borrowed from the pool + */ public void activate(T object); /** - * invoked on every instance that is returned to the pool - */ + * invoked on every instance that is returned to the pool + */ public void passivate(T object); } diff --git a/Dorkbox-Util/src/dorkbox/util/objectPool/SlowObjectPool.java b/Dorkbox-Util/src/dorkbox/util/objectPool/SlowObjectPool.java index 0cc15d7..fad7194 100644 --- a/Dorkbox-Util/src/dorkbox/util/objectPool/SlowObjectPool.java +++ b/Dorkbox-Util/src/dorkbox/util/objectPool/SlowObjectPool.java @@ -1,13 +1,8 @@ -package dorkbox.util.objectPool; - /* - * * from: http://ashkrit.blogspot.de/2013/05/lock-less-java-object-pool.html * https://github.com/ashkrit/blog/tree/master/FastObjectPool * copyright ashkrit 2013 * - * MODIFIED by Nathan Robinson to be a version that is compatible with Android. - * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -19,7 +14,10 @@ package dorkbox.util.objectPool; * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Modified by dorkbox, llc */ +package dorkbox.util.objectPool; import java.util.concurrent.LinkedBlockingDeque; diff --git a/Dorkbox-Util/src/dorkbox/util/process/JavaProcessBuilder.java b/Dorkbox-Util/src/dorkbox/util/process/JavaProcessBuilder.java index 7107108..98ae6ad 100644 --- a/Dorkbox-Util/src/dorkbox/util/process/JavaProcessBuilder.java +++ b/Dorkbox-Util/src/dorkbox/util/process/JavaProcessBuilder.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.process; import java.io.File; diff --git a/Dorkbox-Util/src/dorkbox/util/process/LauncherProcessBuilder.java b/Dorkbox-Util/src/dorkbox/util/process/LauncherProcessBuilder.java index 3fbd129..32dba72 100644 --- a/Dorkbox-Util/src/dorkbox/util/process/LauncherProcessBuilder.java +++ b/Dorkbox-Util/src/dorkbox/util/process/LauncherProcessBuilder.java @@ -1,10 +1,20 @@ +/* + * Copyright 2010 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.process; - - - - - import java.io.File; import java.io.InputStream; import java.io.PrintStream; @@ -35,11 +45,11 @@ public class LauncherProcessBuilder extends ShellProcessBuilder { } public final void addJvmClasspath(String classpathEntry) { - classpathEntries.add(classpathEntry); + this.classpathEntries.add(classpathEntry); } public final void addJvmClasspaths(List paths) { - classpathEntries.addAll(paths); + this.classpathEntries.addAll(paths); } public final void setJarFile(String jarFile) { @@ -49,10 +59,10 @@ public class LauncherProcessBuilder extends ShellProcessBuilder { private String getClasspath() { StringBuilder builder = new StringBuilder(); int count = 0; - final int totalSize = classpathEntries.size(); + final int totalSize = this.classpathEntries.size(); final String pathseparator = File.pathSeparator; - for (String classpathEntry : classpathEntries) { + for (String classpathEntry : this.classpathEntries) { // fix a nasty problem when spaces aren't properly escaped! classpathEntry = classpathEntry.replaceAll(" ", "\\ "); builder.append(classpathEntry); @@ -74,21 +84,21 @@ public class LauncherProcessBuilder extends ShellProcessBuilder { // save off the original arguments - List origArguments = new ArrayList(arguments.size()); - origArguments.addAll(arguments); - arguments = new ArrayList(0); + List origArguments = new ArrayList(this.arguments.size()); + origArguments.addAll(this.arguments); + this.arguments = new ArrayList(0); - arguments.add("-Xms40M"); - arguments.add("-Xmx256M"); + this.arguments.add("-Xms40M"); + this.arguments.add("-Xmx256M"); // arguments.add("-XX:PermSize=256M"); // default is 96 - arguments.add("-server"); + this.arguments.add("-server"); //same as -cp String classpath = getClasspath(); // two more versions. jar vs classs - if (jarFile != null) { + if (this.jarFile != null) { // JAR is added by the launcher (based in the ini file!) // arguments.add("-jar"); // arguments.add(jarFile); @@ -103,12 +113,12 @@ public class LauncherProcessBuilder extends ShellProcessBuilder { } // if we are running classes! - else if (mainClass != null) { - arguments.add(mainClass); + else if (this.mainClass != null) { + this.arguments.add(this.mainClass); if (!classpath.isEmpty()) { - arguments.add("-classpath"); - arguments.add(classpath); + this.arguments.add("-classpath"); + this.arguments.add(classpath); } } else { System.err.println("WHOOPS. You must specify a jar or main class when running java!"); @@ -116,20 +126,20 @@ public class LauncherProcessBuilder extends ShellProcessBuilder { } - for (String arg : mainClassArguments) { + for (String arg : this.mainClassArguments) { if (arg.contains(" ")) { // individual arguments MUST be in their own element in order to // be processed properly (this is how it works on the command line!) String[] split = arg.split(" "); for (String s : split) { - arguments.add(s); + this.arguments.add(s); } } else { - arguments.add(arg); + this.arguments.add(arg); } } - arguments.addAll(origArguments); + this.arguments.addAll(origArguments); super.start(); } diff --git a/Dorkbox-Util/src/dorkbox/util/process/NullOutputStream.java b/Dorkbox-Util/src/dorkbox/util/process/NullOutputStream.java index 2c6a181..4f8cb46 100644 --- a/Dorkbox-Util/src/dorkbox/util/process/NullOutputStream.java +++ b/Dorkbox-Util/src/dorkbox/util/process/NullOutputStream.java @@ -1,4 +1,20 @@ +/* + * Copyright 2010 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.process; + import java.io.IOException; import java.io.OutputStream; diff --git a/Dorkbox-Util/src/dorkbox/util/process/ProcessProxy.java b/Dorkbox-Util/src/dorkbox/util/process/ProcessProxy.java index 4ced31c..e838a0a 100644 --- a/Dorkbox-Util/src/dorkbox/util/process/ProcessProxy.java +++ b/Dorkbox-Util/src/dorkbox/util/process/ProcessProxy.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.process; import java.io.IOException; diff --git a/Dorkbox-Util/src/dorkbox/util/process/ShellProcessBuilder.java b/Dorkbox-Util/src/dorkbox/util/process/ShellProcessBuilder.java index 9b3d278..121e4a1 100644 --- a/Dorkbox-Util/src/dorkbox/util/process/ShellProcessBuilder.java +++ b/Dorkbox-Util/src/dorkbox/util/process/ShellProcessBuilder.java @@ -1,8 +1,20 @@ +/* + * Copyright 2010 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.process; - - - import java.io.File; import java.io.InputStream; import java.io.PrintStream; diff --git a/Dorkbox-Util/src/dorkbox/util/properties/PropertiesProvider.java b/Dorkbox-Util/src/dorkbox/util/properties/PropertiesProvider.java index 110c508..28b71ed 100644 --- a/Dorkbox-Util/src/dorkbox/util/properties/PropertiesProvider.java +++ b/Dorkbox-Util/src/dorkbox/util/properties/PropertiesProvider.java @@ -1,6 +1,20 @@ +/* + * Copyright 2010 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.properties; - import java.awt.Color; import java.io.File; import java.io.FileInputStream; @@ -32,14 +46,14 @@ public class PropertiesProvider { } private final void _load() { - if (!propertiesFile.canRead() || !propertiesFile.exists()) { + if (!this.propertiesFile.canRead() || !this.propertiesFile.exists()) { // in this case, our properties file doesn't exist yet... create one! _save(); } try { - FileInputStream fis = new FileInputStream(propertiesFile); - properties.load(fis); + FileInputStream fis = new FileInputStream(this.propertiesFile); + this.properties.load(fis); fis.close(); } catch (FileNotFoundException e) { @@ -54,8 +68,8 @@ public class PropertiesProvider { private final void _save() { try { - FileOutputStream fos = new FileOutputStream(propertiesFile); - properties.store(fos, "Settings and configuration file. Strings must be escape formatted!"); + FileOutputStream fos = new FileOutputStream(this.propertiesFile); + this.properties.store(fos, "Settings and configuration file. Strings must be escape formatted!"); fos.flush(); fos.close(); @@ -71,7 +85,7 @@ public class PropertiesProvider { public synchronized final void remove(final String key) { - properties.remove(key); + this.properties.remove(key); _save(); } @@ -84,7 +98,7 @@ public class PropertiesProvider { value = ((Color)value).getRGB(); } - properties.setProperty(key, value.toString()); + this.properties.setProperty(key, value.toString()); _save(); } @@ -95,7 +109,7 @@ public class PropertiesProvider { return null; } - String property = properties.getProperty(key); + String property = this.properties.getProperty(key); if (property == null) { return null; } @@ -122,6 +136,6 @@ public class PropertiesProvider { @Override public String toString() { - return "PropertiesProvider [" + propertiesFile + "]"; + return "PropertiesProvider [" + this.propertiesFile + "]"; } } diff --git a/Dorkbox-Util/src/dorkbox/util/properties/SortedProperties.java b/Dorkbox-Util/src/dorkbox/util/properties/SortedProperties.java index 7298bff..86a4a1f 100644 --- a/Dorkbox-Util/src/dorkbox/util/properties/SortedProperties.java +++ b/Dorkbox-Util/src/dorkbox/util/properties/SortedProperties.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.properties; import java.util.Collections; diff --git a/Dorkbox-Util/src/org/bouncycastle/jcajce/provider/asymmetric/dsa/BCDSAPublicKeyAccessor.java b/Dorkbox-Util/src/org/bouncycastle/jcajce/provider/asymmetric/dsa/BCDSAPublicKeyAccessor.java index 475d877..2ef609c 100644 --- a/Dorkbox-Util/src/org/bouncycastle/jcajce/provider/asymmetric/dsa/BCDSAPublicKeyAccessor.java +++ b/Dorkbox-Util/src/org/bouncycastle/jcajce/provider/asymmetric/dsa/BCDSAPublicKeyAccessor.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.bouncycastle.jcajce.provider.asymmetric.dsa; import java.math.BigInteger; diff --git a/Dorkbox-Util/src/org/bouncycastle/jcajce/provider/asymmetric/rsa/BCRSAPublicKeyAccessor.java b/Dorkbox-Util/src/org/bouncycastle/jcajce/provider/asymmetric/rsa/BCRSAPublicKeyAccessor.java index aa8edae..cdb16be 100644 --- a/Dorkbox-Util/src/org/bouncycastle/jcajce/provider/asymmetric/rsa/BCRSAPublicKeyAccessor.java +++ b/Dorkbox-Util/src/org/bouncycastle/jcajce/provider/asymmetric/rsa/BCRSAPublicKeyAccessor.java @@ -1,8 +1,22 @@ +/* + * Copyright 2010 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.bouncycastle.jcajce.provider.asymmetric.rsa; import org.bouncycastle.crypto.params.RSAKeyParameters; - public class BCRSAPublicKeyAccessor { public static BCRSAPublicKey newInstance(RSAKeyParameters publicKey) { return new BCRSAPublicKey(publicKey); diff --git a/Dorkbox-Util/src/org/bouncycastle/jcajce/provider/asymmetric/x509/X509Accessor.java b/Dorkbox-Util/src/org/bouncycastle/jcajce/provider/asymmetric/x509/X509Accessor.java index 3d76357..65c7eee 100644 --- a/Dorkbox-Util/src/org/bouncycastle/jcajce/provider/asymmetric/x509/X509Accessor.java +++ b/Dorkbox-Util/src/org/bouncycastle/jcajce/provider/asymmetric/x509/X509Accessor.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.bouncycastle.jcajce.provider.asymmetric.x509; import java.security.cert.CertificateExpiredException; diff --git a/Dorkbox-Util/src/org/bouncycastle/math/ec/ECAccessor.java b/Dorkbox-Util/src/org/bouncycastle/math/ec/ECAccessor.java index 70ed1dd..11e44c3 100644 --- a/Dorkbox-Util/src/org/bouncycastle/math/ec/ECAccessor.java +++ b/Dorkbox-Util/src/org/bouncycastle/math/ec/ECAccessor.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.bouncycastle.math.ec; public class ECAccessor {