diff options
-rw-r--r-- | src/com/isode/stroke/base/ByteArray.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/com/isode/stroke/base/ByteArray.java b/src/com/isode/stroke/base/ByteArray.java index 077c58c..22d81b7 100644 --- a/src/com/isode/stroke/base/ByteArray.java +++ b/src/com/isode/stroke/base/ByteArray.java @@ -77,7 +77,7 @@ public class ByteArray { * @return array copy of internal data, will never be null, but may * contain zero elements. */ - public byte[] getData() { + public synchronized byte[] getData() { if (dataCopy_ == null) { dataCopy_ = new byte[getSize()]; for (int i = 0; i < data_.size(); i++) { @@ -167,7 +167,7 @@ public class ByteArray { * @param b a single byte * @return a reference to the updated object */ - public ByteArray append(byte b) { + public synchronized ByteArray append(byte b) { dataCopy_ = null; /* Invalidate cache */ data_.add(Byte.valueOf(b)); return this; @@ -191,7 +191,7 @@ public class ByteArray { } @Override - public int hashCode() { + public synchronized int hashCode() { int hash = 3; hash = 97 * hash + (this.data_ != null ? this.data_.hashCode() : 0); return hash; @@ -278,7 +278,7 @@ public class ByteArray { /** * Clears the contents of this ByteArray, leaving it with zero elements. */ - public void clear() { + public synchronized void clear() { data_ = new Vector<Byte>(); dataCopy_ = null; } |