commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1441748 - in /commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging: common/BinaryOutputStream.java formats/bmp/BmpImageParser.java formats/pcx/PcxWriter.java formats/tiff/write/TiffOutputField.java
Date Sat, 02 Feb 2013 14:00:50 GMT
Author: damjan
Date: Sat Feb  2 14:00:50 2013
New Revision: 1441748

URL: http://svn.apache.org/viewvc?rev=1441748&view=rev
Log:
Add some missing methods in BinaryOutputStream.


Modified:
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java?rev=1441748&r1=1441747&r2=1441748&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java
Sat Feb  2 14:00:50 2013
@@ -57,6 +57,28 @@ public class BinaryOutputStream extends 
         count++;
     }
 
+    @Override
+    public final void write(final byte bytes[]) throws IOException {
+        os.write(bytes, 0, bytes.length);
+        count += bytes.length;
+    }
+    
+    @Override
+    public final void write(final byte bytes[], int offset, int length) throws IOException
{
+        os.write(bytes, offset, length);
+        count += length;
+    }
+    
+    @Override
+    public void flush() throws IOException {
+        os.flush();
+    }
+    
+    @Override
+    public void close() throws IOException {
+        os.close();
+    }
+    
     public int getByteCount() {
         return count;
     }
@@ -96,9 +118,4 @@ public class BinaryOutputStream extends 
             write(0xff & (value >> 8));
         }
     }
-
-    public final void writeByteArray(final byte bytes[]) throws IOException {
-        os.write(bytes, 0, bytes.length);
-        count += bytes.length;
-    }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java?rev=1441748&r1=1441747&r2=1441748&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java
Sat Feb  2 14:00:50 2013
@@ -858,7 +858,7 @@ public class BmpImageParser extends Imag
         // write Palette
         writer.writePalette(bos);
         // write Image Data
-        bos.writeByteArray(imagedata);
+        bos.write(imagedata);
     }
 
     /**

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java?rev=1441748&r1=1441747&r2=1441748&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
Sat Feb  2 14:00:50 2013
@@ -95,7 +95,7 @@ public class PcxWriter implements PcxCon
     private void writeScanLine(final BinaryOutputStream bos, final byte[] scanline)
             throws IOException, ImageWriteException {
         if (encoding == PcxImageParser.PcxHeader.ENCODING_UNCOMPRESSED) {
-            bos.writeByteArray(scanline);
+            bos.write(scanline);
         } else {
             if (encoding == PcxImageParser.PcxHeader.ENCODING_RLE) {
                 int previousByte = -1;
@@ -189,14 +189,14 @@ public class PcxWriter implements PcxCon
         bos.write2Bytes((short) Math.round(pixelDensity
                 .horizontalDensityInches())); // hDpi
         bos.write2Bytes((short) Math.round(pixelDensity.verticalDensityInches())); // vDpi
-        bos.writeByteArray(new byte[48]); // 16 color palette
+        bos.write(new byte[48]); // 16 color palette
         bos.write(0); // reserved
         bos.write(1); // planes
         bos.write2Bytes(bytesPerLine); // bytes per line
         bos.write2Bytes(1); // palette info
         bos.write2Bytes(0); // hScreenSize
         bos.write2Bytes(0); // vScreenSize
-        bos.writeByteArray(new byte[54]);
+        bos.write(new byte[54]);
 
         final int rgbs[] = new int[src.getWidth()];
         final byte rgbBytes[] = new byte[4 * bytesPerLine];
@@ -229,14 +229,14 @@ public class PcxWriter implements PcxCon
         bos.write2Bytes((short) Math.round(pixelDensity
                 .horizontalDensityInches())); // hDpi
         bos.write2Bytes((short) Math.round(pixelDensity.verticalDensityInches())); // vDpi
-        bos.writeByteArray(new byte[48]); // 16 color palette
+        bos.write(new byte[48]); // 16 color palette
         bos.write(0); // reserved
         bos.write(3); // planes
         bos.write2Bytes(bytesPerLine); // bytes per line
         bos.write2Bytes(1); // palette info
         bos.write2Bytes(0); // hScreenSize
         bos.write2Bytes(0); // vScreenSize
-        bos.writeByteArray(new byte[54]);
+        bos.write(new byte[54]);
 
         final int rgbs[] = new int[src.getWidth()];
         final byte rgbBytes[] = new byte[3 * bytesPerLine];
@@ -272,14 +272,14 @@ public class PcxWriter implements PcxCon
         bos.write2Bytes((short) Math.round(pixelDensity
                 .horizontalDensityInches())); // hDpi
         bos.write2Bytes((short) Math.round(pixelDensity.verticalDensityInches())); // vDpi
-        bos.writeByteArray(new byte[48]); // 16 color palette
+        bos.write(new byte[48]); // 16 color palette
         bos.write(0); // reserved
         bos.write(1); // planes
         bos.write2Bytes(bytesPerLine); // bytes per line
         bos.write2Bytes(1); // palette info
         bos.write2Bytes(0); // hScreenSize
         bos.write2Bytes(0); // vScreenSize
-        bos.writeByteArray(new byte[54]);
+        bos.write(new byte[54]);
 
         final byte[] row = new byte[bytesPerLine];
         for (int y = 0; y < src.getHeight(); y++) {
@@ -333,14 +333,14 @@ public class PcxWriter implements PcxCon
         bos.write2Bytes((short) Math.round(pixelDensity
                 .horizontalDensityInches())); // hDpi
         bos.write2Bytes((short) Math.round(pixelDensity.verticalDensityInches())); // vDpi
-        bos.writeByteArray(palette16); // 16 color palette
+        bos.write(palette16); // 16 color palette
         bos.write(0); // reserved
         bos.write(1); // planes
         bos.write2Bytes(bytesPerLine); // bytes per line
         bos.write2Bytes(1); // palette info
         bos.write2Bytes(0); // hScreenSize
         bos.write2Bytes(0); // vScreenSize
-        bos.writeByteArray(new byte[54]);
+        bos.write(new byte[54]);
 
         final byte[] indeces = new byte[bytesPerLine];
         for (int y = 0; y < src.getHeight(); y++) {
@@ -371,14 +371,14 @@ public class PcxWriter implements PcxCon
         bos.write2Bytes((short) Math.round(pixelDensity
                 .horizontalDensityInches())); // hDpi
         bos.write2Bytes((short) Math.round(pixelDensity.verticalDensityInches())); // vDpi
-        bos.writeByteArray(new byte[48]); // 16 color palette
+        bos.write(new byte[48]); // 16 color palette
         bos.write(0); // reserved
         bos.write(1); // planes
         bos.write2Bytes(bytesPerLine); // bytes per line
         bos.write2Bytes(1); // palette info
         bos.write2Bytes(0); // hScreenSize
         bos.write2Bytes(0); // vScreenSize
-        bos.writeByteArray(new byte[54]);
+        bos.write(new byte[54]);
 
         final byte[] indeces = new byte[bytesPerLine];
         for (int y = 0; y < src.getHeight(); y++) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java?rev=1441748&r1=1441747&r2=1441748&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java
Sat Feb  2 14:00:50 2013
@@ -81,7 +81,7 @@ public class TiffOutputField implements 
                         "Local value has invalid length: " + bytes.length);
             }
 
-            bos.writeByteArray(bytes);
+            bos.write(bytes);
             final int remainder = TIFF_ENTRY_MAX_VALUE_LENGTH - bytes.length;
             for (int i = 0; i < remainder; i++) {
                 bos.write(0);



Mime
View raw message