Use outputstream.write instead of writeByte (slightly more efficient)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/GIFFileFormat.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/GIFFileFormat.java
index 3ea6c49..6e38c5b 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/GIFFileFormat.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/GIFFileFormat.java
@@ -471,9 +471,9 @@
int bitField = globalTable*128 + (depth-1)*16 + depth-1;
outputStream.writeShort((short)logicalScreenWidth);
outputStream.writeShort((short)logicalScreenHeight);
- outputStream.writeByte((byte)bitField);
- outputStream.writeByte((byte)backgroundPixel);
- outputStream.writeByte((byte)0); // Aspect ratio is 1:1
+ outputStream.write(bitField);
+ outputStream.write(backgroundPixel);
+ outputStream.write(0); // Aspect ratio is 1:1
} catch (IOException e) {
SWT.error(SWT.ERROR_IO, e);
}
@@ -489,12 +489,12 @@
try {
outputStream.write(GIF_EXTENSION_BLOCK_ID);
outputStream.write(GIF_APPLICATION_EXTENSION_BLOCK_ID);
- outputStream.writeByte((byte)NETSCAPE2_0.length);
+ outputStream.write(NETSCAPE2_0.length);
outputStream.write(NETSCAPE2_0);
- outputStream.writeByte((byte)3); // Three bytes follow
- outputStream.writeByte((byte)1); // Extension type
+ outputStream.write(3); // Three bytes follow
+ outputStream.write(1); // Extension type
outputStream.writeShort((short) repeatCount);
- outputStream.writeByte((byte)0); // Block terminator
+ outputStream.write(0); // Block terminator
} catch (IOException e) {
SWT.error(SWT.ERROR_IO, e);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LEDataOutputStream.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LEDataOutputStream.java
index 8fa4917..351e9a5 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LEDataOutputStream.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LEDataOutputStream.java
@@ -18,9 +18,10 @@
public LEDataOutputStream(OutputStream output) {
this.out = output;
}
-public void close() throws IOException {
- out.close();
-}
+/**
+ * Write the specified number of bytes of the given byte array,
+ * starting at the specified offset, to the output stream.
+ */
public void write(byte b[], int off, int len) throws IOException {
out.write(b, off, len);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/TIFFDirectory.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/TIFFDirectory.java
index 4915427..704840d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/TIFFDirectory.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/TIFFDirectory.java
@@ -571,8 +571,8 @@
void writeHeader() throws IOException {
/* little endian */
- out.writeByte((byte)0x49);
- out.writeByte((byte)0x49);
+ out.write(0x49);
+ out.write(0x49);
/* TIFF identifier */
out.writeShort(42);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/WinICOFileFormat.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/WinICOFileFormat.java
index 1fd3d62..8696904 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/WinICOFileFormat.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/WinICOFileFormat.java
@@ -249,8 +249,8 @@
int offset = headerSize + 6;
int iconSize = iconSize(i);
try {
- outputStream.writeByte((byte)i.width);
- outputStream.writeByte((byte)i.height);
+ outputStream.write(i.width);
+ outputStream.write(i.height);
outputStream.writeShort(i.palette.colors != null ? i.palette.colors.length : 0);
outputStream.writeShort(0);
outputStream.writeShort(0);