java - (J2me) Stream as a buffer? -


here got j2me application , need transmit or save live data output stream.

what happen if use 1 thread write data stream , after writing no ofl bytes other thread bytearray out of save or transmit , reset stream zero..

i.e calling reset on .. equals using stream fixed size buffer..

the constrain here may not able use bytebuffer object purpose

will make stream invalid because first thread still wiring it?

i assume going use java.io.bytearrayoutputstream class, part of cldc 1.0 standard of j2me.

cldc 1.0 not thread safety of bytearrayoutputstream.

but if implementation of bytearrayoutputstream, needed methods seems synchronized:

public synchronized byte tobytearray()[] { ... } public synchronized void reset() { ... } public synchronized void write(byte b[], int off, int len) { ... } 

if have access sources of j2me classes. can double check that.

if methods synchronized, should safe use stream plan.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -