-/*******************************************************************************\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.IOException;\r
-import java.nio.ByteBuffer;\r
+import java.io.IOException;
+import java.nio.ByteBuffer;
/**
* IWriteable implementation with ByteBuffer as backend
public void write(int b) {
buf.put((byte) b);
}
-\r
- @Override\r
- public void writeByte(int b) throws IOException {\r
- buf.put((byte) b);\r
- }\r
- \r
- @Override\r
- public void writeBoolean(boolean v) throws IOException {\r
- buf.put( (byte) (v ? 1 : 0) );\r
- }\r
+
+ @Override
+ public void writeByte(int b) throws IOException {
+ buf.put((byte) b);
+ }
+
+ @Override
+ public void writeBoolean(boolean v) throws IOException {
+ buf.put( (byte) (v ? 1 : 0) );
+ }
@Override
public void writeFully(ByteBuffer src) {
}
@Override
- public void writeDouble(double value) {\r
- buf.putDouble(value);\r
+ public void writeDouble(double value) {
+ buf.putDouble(value);
}
@Override
public void writeFloat(float value) {
- buf.putFloat(value);\r
+ buf.putFloat(value);
}
@Override
@Override
public void writeShort(int value) {
buf.putShort((short)value);
- }\r
- \r
- @Override\r
- public void writeChar(int value) {\r
- buf.putChar((char) value);\r
+ }
+
+ @Override
+ public void writeChar(int value) {
+ buf.putChar((char) value);
}
-\r
- @Override\r
- public void writeBytes(String s) throws IOException {\r
- int len = s.length();\r
- for (int i = 0 ; i < len ; i++) {\r
- buf.put((byte)s.charAt(i));\r
- }\r
- }\r
- \r
- @Override\r
- public void writeChars(String s) throws IOException {\r
- int len = s.length();\r
- for (int i = 0 ; i < len ; i++) {\r
- char v = s.charAt(i);\r
- buf.putChar(v);\r
- }\r
- }\r
- \r
- @Override\r
- public void writeUTF(String s) throws IOException {\r
- int len = UTF8.getModifiedUTF8EncodingByteLength(s);\r
- writeShort(len);\r
- UTF8.writeModifiedUTF(this, s);\r
+
+ @Override
+ public void writeBytes(String s) throws IOException {
+ int len = s.length();
+ for (int i = 0 ; i < len ; i++) {
+ buf.put((byte)s.charAt(i));
+ }
+ }
+
+ @Override
+ public void writeChars(String s) throws IOException {
+ int len = s.length();
+ for (int i = 0 ; i < len ; i++) {
+ char v = s.charAt(i);
+ buf.putChar(v);
+ }
+ }
+
+ @Override
+ public void writeUTF(String s) throws IOException {
+ int len = UTF8.getModifiedUTF8EncodingByteLength(s);
+ writeShort(len);
+ UTF8.writeModifiedUTF(this, s);
}
@Override