]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/gfx/clipboard/streams/UncompressedDIBInputStream.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.utils.ui / src / org / simantics / utils / ui / gfx / clipboard / streams / UncompressedDIBInputStream.java
index c90f45b74cf38420ffa062273378bd416107384d..7d036b1543e99b6f5f1499904fd137f33a171492 100644 (file)
@@ -1,71 +1,71 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.utils.ui.gfx.clipboard.streams;\r
-\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-\r
-import org.simantics.utils.ui.gfx.clipboard.headers.BitmapInfoHeader;\r
-import org.simantics.utils.ui.gfx.clipboard.headers.Win32Constants;\r
-\r
-\r
-/**\r
- * <p>\r
- * Intended to uncompress compressed image streams so that \r
- * SWT can use images sent to clipboard (native WIN32)\r
- * </p>\r
- * <p>\r
- * Currently no uncompression methods are implemented, so \r
- * stream throws <code>IOException</code> if its used to \r
- * stream compressed images.\r
- * </p>\r
- * \r
- * @author Marko Luukkainen\r
- *\r
- */\r
-public class UncompressedDIBInputStream extends InputStream {\r
-    private InputStream iStream;\r
-    private int readBytes = 0;\r
-    private byte [] header;\r
-    \r
-    public UncompressedDIBInputStream(InputStream iStream) throws IOException{\r
-        this.iStream = iStream;\r
-        header = new byte[BitmapInfoHeader.sizeof];\r
-        iStream.read(header, 0, BitmapInfoHeader.sizeof);\r
-        \r
-        BitmapInfoHeader infoHeader = new BitmapInfoHeader();\r
-        infoHeader.setBytes(header);\r
-        if (infoHeader.biCompression == Win32Constants.BI_BITFIELDS) {\r
-            throw new IOException("BI_BITFIELDS stream not supported");\r
-        }\r
-        if (infoHeader.biCompression == Win32Constants.BI_JPEG) {\r
-            throw new IOException("BI_JPEG stream not supported");\r
-        }\r
-        if (infoHeader.biCompression == Win32Constants.BI_PNG) {\r
-            throw new IOException("BI_PNG stream not supported");\r
-        }\r
-        if (infoHeader.biCompression == Win32Constants.BI_RLE8) {\r
-            throw new IOException("BI_RLE8 stream not supported");\r
-        }\r
-        if (infoHeader.biCompression == Win32Constants.BI_RLE24) {\r
-            throw new IOException("BI_RLE24 stream not supported");\r
-        }\r
-    }\r
-    \r
-    @Override\r
-    public int read() throws IOException {\r
-        if (readBytes < header.length) {\r
-            return 0xff & header[readBytes++];\r
-        }\r
-        return iStream.read();\r
-    }\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.utils.ui.gfx.clipboard.streams;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.simantics.utils.ui.gfx.clipboard.headers.BitmapInfoHeader;
+import org.simantics.utils.ui.gfx.clipboard.headers.Win32Constants;
+
+
+/**
+ * <p>
+ * Intended to uncompress compressed image streams so that 
+ * SWT can use images sent to clipboard (native WIN32)
+ * </p>
+ * <p>
+ * Currently no uncompression methods are implemented, so 
+ * stream throws <code>IOException</code> if its used to 
+ * stream compressed images.
+ * </p>
+ * 
+ * @author Marko Luukkainen
+ *
+ */
+public class UncompressedDIBInputStream extends InputStream {
+    private InputStream iStream;
+    private int readBytes = 0;
+    private byte [] header;
+    
+    public UncompressedDIBInputStream(InputStream iStream) throws IOException{
+        this.iStream = iStream;
+        header = new byte[BitmapInfoHeader.sizeof];
+        iStream.read(header, 0, BitmapInfoHeader.sizeof);
+        
+        BitmapInfoHeader infoHeader = new BitmapInfoHeader();
+        infoHeader.setBytes(header);
+        if (infoHeader.biCompression == Win32Constants.BI_BITFIELDS) {
+            throw new IOException("BI_BITFIELDS stream not supported");
+        }
+        if (infoHeader.biCompression == Win32Constants.BI_JPEG) {
+            throw new IOException("BI_JPEG stream not supported");
+        }
+        if (infoHeader.biCompression == Win32Constants.BI_PNG) {
+            throw new IOException("BI_PNG stream not supported");
+        }
+        if (infoHeader.biCompression == Win32Constants.BI_RLE8) {
+            throw new IOException("BI_RLE8 stream not supported");
+        }
+        if (infoHeader.biCompression == Win32Constants.BI_RLE24) {
+            throw new IOException("BI_RLE24 stream not supported");
+        }
+    }
+    
+    @Override
+    public int read() throws IOException {
+        if (readBytes < header.length) {
+            return 0xff & header[readBytes++];
+        }
+        return iStream.read();
+    }
+}