java equivalent of bcopy and bzero

Is there a java equivalent to c++ bcopy and bzero functions?
It not, does anyone have any suggestions on how I should go
about implementing them?

Thanks for your help.
raihanAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
JWBitoConnect With a Mentor Commented:
Considering that bcopy and bzero allow one to write anywhere on the process address space, we are glad that Java does not provide the equivalent capability.

Whenever you create a new object, Java guarantees that it will have some initial value.  Primitive scalars (int, float and the like) are initialized to zero.  Booleans are false, and object references are null.

If you have a buffer that you need to move around, you might need to resort to System.arraycopy().  I would try to stay at a higher level and take advantage of Object.clone() for bcopy().  If you need to reinitialize something and are thinking of bzero, perhaps you should reconsider and try something similar to StringBuffer.setLength(0).  Of course, not all are allowed to be reinitialized.
0
All Courses

From novice to tech pro — start learning today.