diff options
author | Mark Spruiell <mes@zeroc.com> | 2001-11-21 21:07:27 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2001-11-21 21:07:27 +0000 |
commit | 7331b062836d26ab63323e2f58c27a6220592ea5 (patch) | |
tree | ebafc1c41f253a6dcdac910127980ec505aed3c3 /java/src/IceInternal/Buffer.java | |
parent | Updated to properly send in the AdapterReady notification and the ProcessId (diff) | |
download | ice-7331b062836d26ab63323e2f58c27a6220592ea5.tar.bz2 ice-7331b062836d26ab63323e2f58c27a6220592ea5.tar.xz ice-7331b062836d26ab63323e2f58c27a6220592ea5.zip |
Initial check-in
Diffstat (limited to 'java/src/IceInternal/Buffer.java')
-rw-r--r-- | java/src/IceInternal/Buffer.java | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/java/src/IceInternal/Buffer.java b/java/src/IceInternal/Buffer.java new file mode 100644 index 00000000000..de08e52f393 --- /dev/null +++ b/java/src/IceInternal/Buffer.java @@ -0,0 +1,51 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +package IceInternal; + +public class Buffer +{ + public + Buffer() + { + data = new byte[1500]; + pos = 0; + len = 0; + } + + public void + resize(int n) + { + if (n > data.length) + { + int sz = data.length << 1; + byte[] arr = new byte[n < sz ? sz : n]; + System.arraycopy(data, 0, arr, 0, len); + data = arr; + } + len = n; + } + + public void + reserve(int n) + { + if (n > data.length) + { + int sz = data.length << 1; + byte[] arr = new byte[n < sz ? sz : n]; + System.arraycopy(data, 0, arr, 0, len); + data = arr; + } + } + + public byte[] data; + public int pos; + public int len; +} |