aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes/com')
-rwxr-xr-xsrc/classes/com/sun/opengl/util/FileUtil.java (renamed from src/classes/com/sun/opengl/impl/io/FileUtil.java)74
-rwxr-xr-xsrc/classes/com/sun/opengl/util/StreamUtil.java (renamed from src/classes/com/sun/opengl/impl/io/StreamUtil.java)84
-rwxr-xr-xsrc/classes/com/sun/opengl/util/TGAWriter.java (renamed from src/classes/com/sun/opengl/util/io/TGAWriter.java)6
-rwxr-xr-xsrc/classes/com/sun/opengl/util/awt/Screenshot.java3
-rwxr-xr-xsrc/classes/com/sun/opengl/util/awt/TextRenderer.java1
-rwxr-xr-xsrc/classes/com/sun/opengl/util/texture/TextureIO.java.javame_cdc_fp2
-rwxr-xr-xsrc/classes/com/sun/opengl/util/texture/TextureIO.java.javase2
-rw-r--r--src/classes/com/sun/opengl/util/texture/spi/awt/IIOTextureWriter.java2
8 files changed, 86 insertions, 88 deletions
diff --git a/src/classes/com/sun/opengl/impl/io/FileUtil.java b/src/classes/com/sun/opengl/util/FileUtil.java
index ef4f26bc2..84b846853 100755
--- a/src/classes/com/sun/opengl/impl/io/FileUtil.java
+++ b/src/classes/com/sun/opengl/util/FileUtil.java
@@ -37,53 +37,53 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.io;
+package com.sun.opengl.util;
import java.io.*;
/** Utilities for dealing with files. */
public class FileUtil {
- private FileUtil() {}
+ private FileUtil() {}
- /**
- * Returns the lowercase suffix of the given file name (the text
- * after the last '.' in the file name). Returns null if the file
- * name has no suffix. Only operates on the given file name;
- * performs no I/O operations.
- *
- * @param file name of the file
- * @return lowercase suffix of the file name
- * @throws NullPointerException if file is null
- */
+ /**
+ * Returns the lowercase suffix of the given file name (the text
+ * after the last '.' in the file name). Returns null if the file
+ * name has no suffix. Only operates on the given file name;
+ * performs no I/O operations.
+ *
+ * @param file name of the file
+ * @return lowercase suffix of the file name
+ * @throws NullPointerException if file is null
+ */
- public static String getFileSuffix(File file) {
- return getFileSuffix(file.getName());
- }
-
- /**
- * Returns the lowercase suffix of the given file name (the text
- * after the last '.' in the file name). Returns null if the file
- * name has no suffix. Only operates on the given file name;
- * performs no I/O operations.
- *
- * @param filename name of the file
- * @return lowercase suffix of the file name
- * @throws NullPointerException if filename is null
- */
- public static String getFileSuffix(String filename) {
- int lastDot = filename.lastIndexOf('.');
- if (lastDot < 0) {
- return null;
+ public static String getFileSuffix(File file) {
+ return getFileSuffix(file.getName());
}
- return toLowerCase(filename.substring(lastDot + 1));
- }
- private static String toLowerCase(String arg) {
- if (arg == null) {
- return null;
+ /**
+ * Returns the lowercase suffix of the given file name (the text
+ * after the last '.' in the file name). Returns null if the file
+ * name has no suffix. Only operates on the given file name;
+ * performs no I/O operations.
+ *
+ * @param filename name of the file
+ * @return lowercase suffix of the file name
+ * @throws NullPointerException if filename is null
+ */
+ public static String getFileSuffix(String filename) {
+ int lastDot = filename.lastIndexOf('.');
+ if (lastDot < 0) {
+ return null;
+ }
+ return toLowerCase(filename.substring(lastDot + 1));
}
- return arg.toLowerCase();
- }
+ private static String toLowerCase(String arg) {
+ if (arg == null) {
+ return null;
+ }
+
+ return arg.toLowerCase();
+ }
}
diff --git a/src/classes/com/sun/opengl/impl/io/StreamUtil.java b/src/classes/com/sun/opengl/util/StreamUtil.java
index 948159223..eeb08175e 100755
--- a/src/classes/com/sun/opengl/impl/io/StreamUtil.java
+++ b/src/classes/com/sun/opengl/util/StreamUtil.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.io;
+package com.sun.opengl.util;
import javax.media.opengl.util.*;
@@ -47,54 +47,54 @@ import java.nio.*;
/** Utilities for dealing with streams. */
public class StreamUtil {
- private StreamUtil() {}
+ private StreamUtil() {}
- public static byte[] readAll2Array(InputStream stream) throws IOException {
- BytesRead bytesRead = readAllImpl(stream);
- byte[] data = bytesRead.data;
- if (bytesRead.payloadLen != data.length) {
- data = new byte[bytesRead.payloadLen];
- System.arraycopy(bytesRead.data, 0, data, 0, bytesRead.payloadLen);
+ public static byte[] readAll2Array(InputStream stream) throws IOException {
+ BytesRead bytesRead = readAllImpl(stream);
+ byte[] data = bytesRead.data;
+ if (bytesRead.payloadLen != data.length) {
+ data = new byte[bytesRead.payloadLen];
+ System.arraycopy(bytesRead.data, 0, data, 0, bytesRead.payloadLen);
+ }
+ return data;
}
- return data;
- }
- public static ByteBuffer readAll2Buffer(InputStream stream) throws IOException {
+ public static ByteBuffer readAll2Buffer(InputStream stream) throws IOException {
BytesRead bytesRead = readAllImpl(stream);
return BufferUtil.newByteBuffer(bytesRead.data, 0, bytesRead.payloadLen);
- }
-
- private static BytesRead readAllImpl(InputStream stream) throws IOException {
- // FIXME: Shall we do this here ?
- if( !(stream instanceof BufferedInputStream) ) {
- stream = new BufferedInputStream(stream);
}
- int avail = stream.available();
- byte[] data = new byte[avail];
- int numRead = 0;
- int pos = 0;
- do {
- if (pos + avail > data.length) {
- byte[] newData = new byte[pos + avail];
- System.arraycopy(data, 0, newData, 0, pos);
- data = newData;
- }
- numRead = stream.read(data, pos, avail);
- if (numRead >= 0) {
- pos += numRead;
- }
- avail = stream.available();
- } while (avail > 0 && numRead >= 0);
- return new BytesRead(pos, data);
- }
+ private static BytesRead readAllImpl(InputStream stream) throws IOException {
+ // FIXME: Shall we do this here ?
+ if( !(stream instanceof BufferedInputStream) ) {
+ stream = new BufferedInputStream(stream);
+ }
+ int avail = stream.available();
+ byte[] data = new byte[avail];
+ int numRead = 0;
+ int pos = 0;
+ do {
+ if (pos + avail > data.length) {
+ byte[] newData = new byte[pos + avail];
+ System.arraycopy(data, 0, newData, 0, pos);
+ data = newData;
+ }
+ numRead = stream.read(data, pos, avail);
+ if (numRead >= 0) {
+ pos += numRead;
+ }
+ avail = stream.available();
+ } while (avail > 0 && numRead >= 0);
+
+ return new BytesRead(pos, data);
+ }
- private static class BytesRead {
- BytesRead(int payloadLen, byte[] data) {
- this.payloadLen=payloadLen;
- this.data=data;
+ private static class BytesRead {
+ BytesRead(int payloadLen, byte[] data) {
+ this.payloadLen=payloadLen;
+ this.data=data;
+ }
+ int payloadLen;
+ byte[] data;
}
- int payloadLen;
- byte[] data;
- }
}
diff --git a/src/classes/com/sun/opengl/util/io/TGAWriter.java b/src/classes/com/sun/opengl/util/TGAWriter.java
index f6ae79049..c5b1041a0 100755
--- a/src/classes/com/sun/opengl/util/io/TGAWriter.java
+++ b/src/classes/com/sun/opengl/util/TGAWriter.java
@@ -34,7 +34,7 @@
* facility.
*/
-package com.sun.opengl.util.io;
+package com.sun.opengl.util;
import java.io.*;
import java.nio.*;
@@ -43,8 +43,8 @@ import java.nio.channels.*;
/**
* Utility class which helps take fast screenshots of OpenGL rendering
* results into Targa-format files. Used by the {@link
- * com.sun.opengl.util.Screenshot Screenshot} class; can also be used
- * in conjunction with the {@link com.sun.opengl.util.TileRenderer
+ * com.sun.opengl.util.gl2.Screenshot Screenshot} class; can also be used
+ * in conjunction with the {@link com.sun.opengl.util.gl2.TileRenderer
* TileRenderer} class. <P>
*/
diff --git a/src/classes/com/sun/opengl/util/awt/Screenshot.java b/src/classes/com/sun/opengl/util/awt/Screenshot.java
index 6c6bc7a26..55099445a 100755
--- a/src/classes/com/sun/opengl/util/awt/Screenshot.java
+++ b/src/classes/com/sun/opengl/util/awt/Screenshot.java
@@ -46,8 +46,7 @@ import javax.media.opengl.*;
import javax.media.opengl.glu.*;
import javax.media.opengl.glu.gl2.*;
-import com.sun.opengl.impl.io.*;
-import com.sun.opengl.util.io.*;
+import com.sun.opengl.util.*;
/** Utilities for taking screenshots of OpenGL applications. */
diff --git a/src/classes/com/sun/opengl/util/awt/TextRenderer.java b/src/classes/com/sun/opengl/util/awt/TextRenderer.java
index 525e0824f..6c9aa578b 100755
--- a/src/classes/com/sun/opengl/util/awt/TextRenderer.java
+++ b/src/classes/com/sun/opengl/util/awt/TextRenderer.java
@@ -41,7 +41,6 @@ package com.sun.opengl.util.awt;
import com.sun.opengl.impl.*;
import com.sun.opengl.impl.packrect.*;
import com.sun.opengl.util.*;
-import com.sun.opengl.util.io.*;
import com.sun.opengl.util.texture.*;
import com.sun.opengl.util.texture.awt.*;
diff --git a/src/classes/com/sun/opengl/util/texture/TextureIO.java.javame_cdc_fp b/src/classes/com/sun/opengl/util/texture/TextureIO.java.javame_cdc_fp
index 3f72fdbff..7ea88a9ca 100755
--- a/src/classes/com/sun/opengl/util/texture/TextureIO.java.javame_cdc_fp
+++ b/src/classes/com/sun/opengl/util/texture/TextureIO.java.javame_cdc_fp
@@ -47,7 +47,7 @@ import java.util.*;
import javax.media.opengl.*;
import javax.media.opengl.glu.*;
import com.sun.opengl.impl.Debug;
-import com.sun.opengl.impl.io.*;
+import com.sun.opengl.util.*;
import com.sun.opengl.util.texture.spi.*;
/** <P> Provides input and output facilities for both loading OpenGL
diff --git a/src/classes/com/sun/opengl/util/texture/TextureIO.java.javase b/src/classes/com/sun/opengl/util/texture/TextureIO.java.javase
index 2cb2d2c9f..aa2cb1799 100755
--- a/src/classes/com/sun/opengl/util/texture/TextureIO.java.javase
+++ b/src/classes/com/sun/opengl/util/texture/TextureIO.java.javase
@@ -47,7 +47,7 @@ import java.util.*;
import javax.media.opengl.*;
import javax.media.opengl.glu.*;
import com.sun.opengl.impl.Debug;
-import com.sun.opengl.impl.io.*;
+import com.sun.opengl.util.*;
import com.sun.opengl.util.texture.spi.*;
/** <P> Provides input and output facilities for both loading OpenGL
diff --git a/src/classes/com/sun/opengl/util/texture/spi/awt/IIOTextureWriter.java b/src/classes/com/sun/opengl/util/texture/spi/awt/IIOTextureWriter.java
index 5700b57bb..db77572bf 100644
--- a/src/classes/com/sun/opengl/util/texture/spi/awt/IIOTextureWriter.java
+++ b/src/classes/com/sun/opengl/util/texture/spi/awt/IIOTextureWriter.java
@@ -47,7 +47,7 @@ import java.nio.*;
import javax.imageio.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.io.*;
+import com.sun.opengl.util.*;
import com.sun.opengl.util.awt.*;
import com.sun.opengl.util.texture.*;
import com.sun.opengl.util.texture.spi.*;