Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

java equivalent of bcopy and bzero

Posted on 1997-04-04
1
1,249 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Apps blocked by Java 9 88
Oracle SQL syntax check  without executing 6 74
How  can  i  resolve  HTTP Status 404 -? 8 42
Eclipse Java import and method not resolved 4 48
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

839 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