Solved

java equivalent of bcopy and bzero

Posted on 1997-04-04
1
1,213 Views
Last Modified: 2008-03-10
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.
0
Comment
Question by:raihan
1 Comment
 
LVL 1

Accepted Solution

by:
JWBito earned 50 total points
ID: 1219423
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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
network + 7 73
mapBully challenge 6 88
Printing to a specific printer tray (HP 806dn printer) 3 62
Systems talking to each other 5 107
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now