]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.databoard/src/org/simantics/databoard/util/binary/InputStreamReadable.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.databoard / src / org / simantics / databoard / util / binary / InputStreamReadable.java
index 17a34aca8fc3c96d57823c199844b01ef0c183d0..f1f44d4b1cc2f5f52be516a4410c143012b72a6c 100644 (file)
@@ -1,23 +1,23 @@
-/*******************************************************************************\r
- *  Copyright (c) 2010 Association for Decentralized Information Management in\r
- *  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
+/*******************************************************************************
+ *  Copyright (c) 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.databoard.util.binary;
 
-import java.io.DataInputStream;\r
-import java.io.EOFException;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.nio.ByteBuffer;\r
-\r
-import org.simantics.databoard.util.StreamUtil;\r
+import java.io.DataInputStream;
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+
+import org.simantics.databoard.util.StreamUtil;
 
 /**
  * Input stream reader
@@ -27,11 +27,11 @@ import org.simantics.databoard.util.StreamUtil;
 public class InputStreamReadable implements BinaryReadable {
 
        InputStream is;
-       long limit, position;\r
-       \r
-       public static BinaryReadable readFully(InputStream is) throws IOException {\r
-               byte[] data = StreamUtil.readFully(is);\r
-               return new BinaryMemory( data );\r
+       long limit, position;
+       
+       public static BinaryReadable readFully(InputStream is) throws IOException {
+               byte[] data = StreamUtil.readFully(is);
+               return new BinaryMemory( data );
        }
        
        public InputStreamReadable(InputStream is, long limit)
@@ -53,51 +53,51 @@ public class InputStreamReadable implements BinaryReadable {
                        throw new EOFException();
                position++;
                return value & 0xff;
-       }\r
-       \r
-       /**\r
-        * Get next byte\r
-        * @return 0..255 or -1 on end of file\r
-        * @throws IOException\r
-        */\r
-       int _read()\r
-       throws IOException\r
-       {\r
-               int value = is.read();\r
-               if (value==-1) return -1;\r
-               position++;             \r
-               return value & 0xff;\r
-       }       \r
-       \r
-    public final String readLine() throws IOException {\r
-       StringBuffer input = new StringBuffer();\r
-       int c = -1;\r
-       boolean eol = false;\r
-\r
-       while (!eol) {\r
-           switch (c = _read()) {\r
-           case -1:\r
-           case '\n':\r
-               eol = true;\r
-               break;\r
-           case '\r':\r
-               eol = true;\r
-//             long cur = position();\r
-//             if ((_read()) != '\n') {\r
-//                 position=cur;\r
-//             }\r
-               break;\r
-           default:\r
-               input.append((char)c);\r
-               break;\r
-           }\r
-       }\r
-\r
-       if ((c == -1) && (input.length() == 0)) {\r
-           return null;\r
-       }\r
-       return input.toString();\r
-    }  \r
+       }
+       
+       /**
+        * Get next byte
+        * @return 0..255 or -1 on end of file
+        * @throws IOException
+        */
+       int _read()
+       throws IOException
+       {
+               int value = is.read();
+               if (value==-1) return -1;
+               position++;             
+               return value & 0xff;
+       }       
+       
+    public final String readLine() throws IOException {
+       StringBuffer input = new StringBuffer();
+       int c = -1;
+       boolean eol = false;
+
+       while (!eol) {
+           switch (c = _read()) {
+           case -1:
+           case '\n':
+               eol = true;
+               break;
+           case '\r':
+               eol = true;
+//             long cur = position();
+//             if ((_read()) != '\n') {
+//                 position=cur;
+//             }
+               break;
+           default:
+               input.append((char)c);
+               break;
+           }
+       }
+
+       if ((c == -1) && (input.length() == 0)) {
+           return null;
+       }
+       return input.toString();
+    }  
        
        
        @Override
@@ -105,23 +105,23 @@ public class InputStreamReadable implements BinaryReadable {
     throws IOException 
        {
                return (byte) _get();
-       }\r
-       \r
-       @Override\r
-       public char readChar() throws IOException {\r
-               return (char) ( (_get() << 8) |  _get() ) ;\r
-       }\r
-       \r
-       @Override\r
-       public int readUnsignedByte() throws IOException {\r
-               return _get() & 0x000000ff;\r
-       }       \r
-\r
-       @Override\r
-       public boolean readBoolean() \r
-    throws IOException \r
-       {\r
-               return _get()!=0;\r
+       }
+       
+       @Override
+       public char readChar() throws IOException {
+               return (char) ( (_get() << 8) |  _get() ) ;
+       }
+       
+       @Override
+       public int readUnsignedByte() throws IOException {
+               return _get() & 0x000000ff;
+       }       
+
+       @Override
+       public boolean readBoolean() 
+    throws IOException 
+       {
+               return _get()!=0;
        }       
 
        @Override
@@ -178,10 +178,10 @@ public class InputStreamReadable implements BinaryReadable {
     throws IOException 
        {
                return Float.intBitsToFloat(readInt());
-       }\r
-       \r
-    public final String readUTF() throws IOException {\r
-       return DataInputStream.readUTF(this);\r
+       }
+       
+    public final String readUTF() throws IOException {
+       return DataInputStream.readUTF(this);
     }  
 
        @Override
@@ -216,13 +216,13 @@ public class InputStreamReadable implements BinaryReadable {
        {
                return (short) ( (_get() << 8) |  _get() ) ;
        }
-\r
-       @Override\r
-       public int readUnsignedShort() \r
-    throws IOException \r
-       {\r
-               return ( (_get() << 8) |  _get() ) ;\r
-       }       \r
+
+       @Override
+       public int readUnsignedShort() 
+    throws IOException 
+       {
+               return ( (_get() << 8) |  _get() ) ;
+       }       
        
        @Override
        public long length() 
@@ -238,15 +238,15 @@ public class InputStreamReadable implements BinaryReadable {
 
        @Override
        public long skipBytes(long bytes) throws IOException {
-               is.skip(bytes); \r
+               is.skip(bytes); 
+               return bytes;
+       }
+
+       @Override
+       public int skipBytes(int bytes) throws IOException {
+               is.skip(bytes); 
                return bytes;
        }
-\r
-       @Override\r
-       public int skipBytes(int bytes) throws IOException {\r
-               is.skip(bytes); \r
-               return bytes;\r
-       }\r
        
 }