More changes to make Froyo compatible.
This commit is contained in:
parent
1eb8f3203f
commit
064dd7f4fa
@ -12,6 +12,7 @@ import java.util.zip.ZipInputStream;
|
||||
import net.sf.openrocket.document.OpenRocketDocument;
|
||||
import net.sf.openrocket.file.openrocket.importt.OpenRocketLoader;
|
||||
import net.sf.openrocket.file.rocksim.importt.RocksimLoader;
|
||||
import net.sf.openrocket.util.ArrayUtils;
|
||||
import net.sf.openrocket.util.TextUtil;
|
||||
|
||||
|
||||
@ -94,7 +95,7 @@ public class GeneralRocketLoader extends AbstractRocketLoader {
|
||||
}
|
||||
}
|
||||
|
||||
byte[] typeIdentifier = Arrays.copyOf(buffer, ROCKSIM_SIGNATURE.length);
|
||||
byte[] typeIdentifier = ArrayUtils.copyOf(buffer, ROCKSIM_SIGNATURE.length);
|
||||
if (Arrays.equals(ROCKSIM_SIGNATURE, typeIdentifier)) {
|
||||
return loadUsing(source, rocksimLoader, motorFinder);
|
||||
}
|
||||
|
@ -330,7 +330,7 @@ class FinSetHandler extends AbstractElementHandler {
|
||||
*/
|
||||
private Coordinate[] toCoordinates (String pointList, WarningSet warnings) {
|
||||
List<Coordinate> result = new ArrayList<Coordinate>();
|
||||
if (pointList != null && !pointList.isEmpty()) {
|
||||
if (pointList != null && pointList.length() > 0) {
|
||||
String[] points = pointList.split("\\Q|\\E");
|
||||
for (String point : points) {
|
||||
String[] aPoint = point.split(",");
|
||||
|
@ -80,4 +80,37 @@ public class ArrayUtils {
|
||||
|
||||
}
|
||||
|
||||
public static byte[] copyOf( byte[] original, int length ) {
|
||||
return copyOfRange(original,0,length);
|
||||
}
|
||||
|
||||
public static byte[] copyOfRange( byte[] original, int start, int end ) {
|
||||
|
||||
if ( original == null ) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
if ( start < 0 || start > original.length ) {
|
||||
throw new ArrayIndexOutOfBoundsException();
|
||||
}
|
||||
|
||||
if ( start > end ) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
byte[] result = new byte[(end-start)];
|
||||
|
||||
int index = 0;
|
||||
int stop = original.length < end ? original.length : end;
|
||||
for ( int i = start; i < stop; i ++ ) {
|
||||
if ( i < original.length ) {
|
||||
result[index] = original[i];
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user