diff options
Diffstat (limited to 'java/src/Ice/OutputStreamI.java')
-rw-r--r-- | java/src/Ice/OutputStreamI.java | 198 |
1 files changed, 198 insertions, 0 deletions
diff --git a/java/src/Ice/OutputStreamI.java b/java/src/Ice/OutputStreamI.java new file mode 100644 index 00000000000..2c040f7acbe --- /dev/null +++ b/java/src/Ice/OutputStreamI.java @@ -0,0 +1,198 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package Ice; + +public class OutputStreamI implements OutputStream +{ + public + OutputStreamI(Communicator communicator) + { + _communicator = communicator; + _os = new IceInternal.BasicOutputStream(Util.getInstance(communicator), this); + _writeObjects = false; + } + + protected void + finalize() + throws Throwable + { + if(_os != null) + { + _os.destroy(); + } + } + + public Communicator + communicator() + { + return _communicator; + } + + public void + writeBool(boolean v) + { + _os.writeBool(v); + } + + public void + writeBoolSeq(boolean[] v) + { + _os.writeBoolSeq(v); + } + + public void + writeByte(byte v) + { + _os.writeByte(v); + } + + public void + writeByteSeq(byte[] v) + { + _os.writeByteSeq(v); + } + + public void + writeShort(short v) + { + _os.writeShort(v); + } + + public void + writeShortSeq(short[] v) + { + _os.writeShortSeq(v); + } + + public void + writeInt(int v) + { + _os.writeInt(v); + } + + public void + writeIntSeq(int[] v) + { + _os.writeIntSeq(v); + } + + public void + writeLong(long v) + { + _os.writeLong(v); + } + + public void + writeLongSeq(long[] v) + { + _os.writeLongSeq(v); + } + + public void + writeFloat(float v) + { + _os.writeFloat(v); + } + + public void + writeFloatSeq(float[] v) + { + _os.writeFloatSeq(v); + } + + public void + writeDouble(double v) + { + _os.writeDouble(v); + } + + public void + writeDoubleSeq(double[] v) + { + _os.writeDoubleSeq(v); + } + + public void + writeString(String v) + { + _os.writeString(v); + } + + public void + writeStringSeq(String[] v) + { + _os.writeStringSeq(v); + } + + public void + writeSize(int sz) + { + _os.writeSize(sz); + } + + public void + writeProxy(ObjectPrx v) + { + _os.writeProxy(v); + } + + public void + writeObject(Ice.Object v) + { + _writeObjects = true; + _os.writeObject(v); + } + + public void + writeTypeId(String id) + { + _os.writeTypeId(id); + } + + public void + writeException(UserException v) + { + _os.writeUserException(v); + } + + public void + startSlice() + { + _os.startWriteSlice(); + } + + public void + endSlice() + { + _os.endWriteSlice(); + } + + public byte[] + finished() + { + if(_writeObjects) + { + _os.writePendingObjects(); + } + + java.nio.ByteBuffer buf = _os.prepareWrite(); + byte[] result = new byte[buf.limit()]; + buf.get(result); + + _os.destroy(); + _os = null; + + return result; + } + + private Communicator _communicator; + private IceInternal.BasicOutputStream _os; + private boolean _writeObjects; +} |