X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.databoard%2Fsrc%2Forg%2Fsimantics%2Fdataboard%2Futil%2Fbinary%2FOutputStreamWriteable.java;fp=bundles%2Forg.simantics.databoard%2Fsrc%2Forg%2Fsimantics%2Fdataboard%2Futil%2Fbinary%2FOutputStreamWriteable.java;h=f6182ee8f0c40d5634e55c351e2450b076deabc2;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=9bea9c369ed8d6d0e86a0571618d07fe89301dce;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.databoard/src/org/simantics/databoard/util/binary/OutputStreamWriteable.java b/bundles/org.simantics.databoard/src/org/simantics/databoard/util/binary/OutputStreamWriteable.java index 9bea9c369..f6182ee8f 100644 --- a/bundles/org.simantics.databoard/src/org/simantics/databoard/util/binary/OutputStreamWriteable.java +++ b/bundles/org.simantics.databoard/src/org/simantics/databoard/util/binary/OutputStreamWriteable.java @@ -1,19 +1,19 @@ -/******************************************************************************* - * 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.io.OutputStream; -import java.nio.ByteBuffer; +import java.io.IOException; +import java.io.OutputStream; +import java.nio.ByteBuffer; public class OutputStreamWriteable implements BinaryWriteable { @@ -39,15 +39,15 @@ public class OutputStreamWriteable implements BinaryWriteable { @Override public void write(int b) throws IOException { _put(b); - } - - @Override - public void writeByte(int b) throws IOException { - _put(b); - } - @Override - public void writeBoolean(boolean v) throws IOException { - _put( v ? 1 : 0); + } + + @Override + public void writeByte(int b) throws IOException { + _put(b); + } + @Override + public void writeBoolean(boolean v) throws IOException { + _put( v ? 1 : 0); } @Override @@ -117,38 +117,38 @@ public class OutputStreamWriteable implements BinaryWriteable { public void writeShort(int value) throws IOException { _put(value >> 8); _put(value); - } - - @Override - public void writeChar(int value) throws IOException { - _put(value >> 8); - _put(value); - } - - @Override - public void writeBytes(String s) throws IOException { - int len = s.length(); - for (int i = 0 ; i < len ; i++) { - _put((byte)s.charAt(i)); - } - } + } + + @Override + public void writeChar(int value) throws IOException { + _put(value >> 8); + _put(value); + } - @Override - public void writeChars(String s) throws IOException { - int len = s.length(); - for (int i = 0 ; i < len ; i++) { - int v = s.charAt(i); - _put((v >>> 8) & 0xFF); - _put((v >>> 0) & 0xFF); - } - } - - @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++) { + _put((byte)s.charAt(i)); + } + } + + @Override + public void writeChars(String s) throws IOException { + int len = s.length(); + for (int i = 0 ; i < len ; i++) { + int v = s.charAt(i); + _put((v >>> 8) & 0xFF); + _put((v >>> 0) & 0xFF); + } + } + + @Override + public void writeUTF(String s) throws IOException { + int len = UTF8.getModifiedUTF8EncodingByteLength(s); + writeShort(len); + UTF8.writeModifiedUTF(this, s); + } @Override public void flush() throws IOException {