Updated license information

This commit is contained in:
nathan 2014-11-04 13:42:19 +01:00
parent c4edf9bd63
commit 74881a07f3
36 changed files with 717 additions and 202 deletions

92
Dorkbox-Util/LICENSE Normal file
View File

@ -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 <badlogicgames@gmail.com>
Nathan Sweet <nathan.sweet@gmail.com>
- 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

View File

@ -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 <badlogicgames@gmail.com>
Nathan Sweet <nathan.sweet@gmail.com>
- 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

View File

@ -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;

View File

@ -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() {}

View File

@ -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();

View File

@ -697,6 +697,19 @@ public class FileUtil {
}
/**
* Parses the specified root directory for <b>ALL</b> files that are in it. All of the sub-directories are searched as well.
* <p>
* <i>This is different, in that it returns ALL FILES, instead of ones that just match a specific extension.</i>
* @return the list of all files in the root+sub-dirs.
*/
public static List<File> 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 <b>ALL</b> files that are in it. All of the sub-directories are searched as well.
* <p>
@ -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.
* <p>
@ -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.
* <p>
* 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.
* <p>
* 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.
* <p>
* The output will be the same on both Unix and Windows except
* for the separator character.
* <pre>
* /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
* </pre>
* (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.
* <p>
@ -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.
* <p>
@ -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 <code>C:/</code> or <code>~/</code>.
* <p>
@ -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
*/

View File

@ -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})

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -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");

View File

@ -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;

View File

@ -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 <misc@n4te.com>, Nathan Robinson
* @author Nathan Sweet <misc@n4te.com>
*/
public class ByteBuffer2 {
private int capacity; // exactly how many bytes have been allocated

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -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;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
// slightly tweaked from libGDX
// slightly tweaked from libGDX, by dorkbox, llc
package dorkbox.util.collections;

View File

@ -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;

View File

@ -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;

View File

@ -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<T> {

View File

@ -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;

View File

@ -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<T> {
AtomicBoolean state = new AtomicBoolean(true);
public ObjectPoolHolder(T value) {
this.value = value;
}

View File

@ -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<T> {
/**
* 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);
}

View File

@ -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;

View File

@ -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;

View File

@ -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<String> 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<String> origArguments = new ArrayList<String>(arguments.size());
origArguments.addAll(arguments);
arguments = new ArrayList<String>(0);
List<String> origArguments = new ArrayList<String>(this.arguments.size());
origArguments.addAll(this.arguments);
this.arguments = new ArrayList<String>(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();
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 + "]";
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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 {