aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/jogamp/common/util')
-rw-r--r--src/java/com/jogamp/common/util/IOUtil.java18
-rw-r--r--src/java/com/jogamp/common/util/VersionUtil.java5
2 files changed, 10 insertions, 13 deletions
diff --git a/src/java/com/jogamp/common/util/IOUtil.java b/src/java/com/jogamp/common/util/IOUtil.java
index b2d9ed4..5b00fb4 100644
--- a/src/java/com/jogamp/common/util/IOUtil.java
+++ b/src/java/com/jogamp/common/util/IOUtil.java
@@ -42,6 +42,7 @@ import java.net.URLConnection;
import java.nio.ByteBuffer;
import com.jogamp.common.nio.Buffers;
+import com.jogamp.common.os.MachineDescription;
import com.jogamp.common.os.Platform;
public class IOUtil {
@@ -81,7 +82,7 @@ public class IOUtil {
* number of bytes written is returned.
*/
public static int copyStream2Stream(InputStream in, OutputStream out, int totalNumBytes) throws IOException {
- final byte[] buf = new byte[Platform.getPageSize()];
+ final byte[] buf = new byte[Platform.getMachineDescription().pageSizeInBytes()];
int numBytes = 0;
while (true) {
int count;
@@ -137,16 +138,16 @@ public class IOUtil {
if( !(stream instanceof BufferedInputStream) ) {
stream = new BufferedInputStream(stream);
}
- int totalRead = 0;
int avail = stream.available();
- ByteBuffer data = Buffers.newDirectByteBuffer( Platform.getPageAlignedSize(avail) );
- byte[] chunk = new byte[Platform.getPageSize()];
- int chunk2Read = Math.min(Platform.getPageSize(), avail);
+ final MachineDescription machine = Platform.getMachineDescription();
+ ByteBuffer data = Buffers.newDirectByteBuffer( machine.pageAlignedSize(avail) );
+ byte[] chunk = new byte[machine.pageSizeInBytes()];
+ int chunk2Read = Math.min(machine.pageSizeInBytes(), avail);
int numRead = 0;
do {
if (avail > data.remaining()) {
- final ByteBuffer newData = Buffers.newDirectByteBuffer(
- Platform.getPageAlignedSize(data.position() + avail) );
+ final ByteBuffer newData = Buffers.newDirectByteBuffer(
+ machine.pageAlignedSize(data.position() + avail) );
newData.put(data);
data = newData;
}
@@ -154,10 +155,9 @@ public class IOUtil {
numRead = stream.read(chunk, 0, chunk2Read);
if (numRead >= 0) {
data.put(chunk, 0, numRead);
- totalRead += numRead;
}
avail = stream.available();
- chunk2Read = Math.min(Platform.getPageSize(), avail);
+ chunk2Read = Math.min(machine.pageSizeInBytes(), avail);
} while (avail > 0 && numRead >= 0);
data.flip();
diff --git a/src/java/com/jogamp/common/util/VersionUtil.java b/src/java/com/jogamp/common/util/VersionUtil.java
index 632e127..1589755 100644
--- a/src/java/com/jogamp/common/util/VersionUtil.java
+++ b/src/java/com/jogamp/common/util/VersionUtil.java
@@ -57,10 +57,7 @@ public class VersionUtil {
sb.append(Platform.getArch()).append(" (arch) ").append(Runtime.getRuntime().availableProcessors()).append(" cores");
sb.append(Platform.getNewline());
- // arch
- sb.append("Platform: littleEndian ").append(Platform.isLittleEndian()).append(", 32Bit ");
- sb.append(Platform.is32Bit()).append(", a-ptr bit-size ").append(Platform.getPointerSizeInBits());
- sb.append(Platform.getNewline());
+ Platform.getMachineDescription().toString(sb).append(Platform.getNewline());
// JVM/JRE
sb.append("Platform: Java ").append(Platform.getJavaVersion()).append(", ").append(System.getProperty("java.vm.name")).append(", ");