X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.databoard%2Fsrc%2Forg%2Fsimantics%2Fdataboard%2Futil%2Fbinary%2FByteBufferWriteable.java;fp=bundles%2Forg.simantics.databoard%2Fsrc%2Forg%2Fsimantics%2Fdataboard%2Futil%2Fbinary%2FByteBufferWriteable.java;h=8b08419b88988a5000fdeab0cd199eb4ce24299b;hp=57cc86106e626f9b41ded841912be6f36632df64;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.databoard/src/org/simantics/databoard/util/binary/ByteBufferWriteable.java b/bundles/org.simantics.databoard/src/org/simantics/databoard/util/binary/ByteBufferWriteable.java index 57cc86106..8b08419b8 100644 --- a/bundles/org.simantics.databoard/src/org/simantics/databoard/util/binary/ByteBufferWriteable.java +++ b/bundles/org.simantics.databoard/src/org/simantics/databoard/util/binary/ByteBufferWriteable.java @@ -1,18 +1,18 @@ -/******************************************************************************* - * 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 - *******************************************************************************/ +/******************************************************************************* + * 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; -import java.nio.ByteBuffer; +import java.io.IOException; +import java.nio.ByteBuffer; /** * IWriteable implementation with ByteBuffer as backend @@ -34,16 +34,16 @@ public class ByteBufferWriteable implements BinaryWriteable { public void write(int b) { buf.put((byte) b); } - - @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 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) { @@ -72,13 +72,13 @@ public class ByteBufferWriteable implements BinaryWriteable { } @Override - public void writeDouble(double value) { - buf.putDouble(value); + public void writeDouble(double value) { + buf.putDouble(value); } @Override public void writeFloat(float value) { - buf.putFloat(value); + buf.putFloat(value); } @Override @@ -94,35 +94,35 @@ public class ByteBufferWriteable implements BinaryWriteable { @Override public void writeShort(int value) { buf.putShort((short)value); - } - - @Override - public void writeChar(int value) { - buf.putChar((char) value); + } + + @Override + public void writeChar(int value) { + buf.putChar((char) value); } - - @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 + 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