473,795 Members | 2,391 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What is the nearest equivalent in C++ to the Java ByteArrayOutput Stream

Hello

I need to port some Java code and am wondering if there is a close
equivalent to ByteArrayOutput Stream.

I have been looking at the STL iostream library but not quite sure what is
best to use.

Any help would be much appreciated.
Jan 3 '07 #1
3 4901
Angus wrote:
I need to port some Java code and am wondering if there is a close
equivalent to ByteArrayOutput Stream.

I have been looking at the STL iostream library but not quite sure
what is best to use.

Any help would be much appreciated.
Any standard stream has 'write' member that takes a pointer to char,
which is probably what you want... What problem are you solving?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jan 3 '07 #2

"Victor Bazarov" <v.********@com Acast.netwrote in message
news:en******** **@news.datemas .de...
Angus wrote:
I need to port some Java code and am wondering if there is a close
equivalent to ByteArrayOutput Stream.

I have been looking at the STL iostream library but not quite sure
what is best to use.

Any help would be much appreciated.

Any standard stream has 'write' member that takes a pointer to char,
which is probably what you want... What problem are you solving?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask

I am working with binary data - so bytes of anything. I am looking at
stringstream but maybe it won't like embedded control characters etc. Do
you know if that is the case? If not what to use?
Jan 3 '07 #3
Angus wrote:
"Victor Bazarov" <v.********@com Acast.netwrote in message
news:en******** **@news.datemas .de...
>Angus wrote:
>>I need to port some Java code and am wondering if there is a close
equivalent to ByteArrayOutput Stream.

I have been looking at the STL iostream library but not quite sure
what is best to use.

Any help would be much appreciated.

Any standard stream has 'write' member that takes a pointer to char,
which is probably what you want... What problem are you solving?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


I am working with binary data - so bytes of anything. I am looking at
stringstream but maybe it won't like embedded control characters etc.
Ah... No such thing as "embedded control characters" in C++, AFAIK.
'char' and 'unsigned char' are just integral types with value ranges.
Do you know if that is the case? If not what to use?
No, it's not the case. It seems you just need 'basic_stringst ream' with
'unsigned char' as its first argument:

std::basic_stri ngstream<unsign ed charmystream;

(if unsigned char [0..255] is the requirement, Java's 'byte' is actually
unsigned) or use std::stringstre am if 'char' is fine; you may need to
cast to unsigned char later.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jan 3 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1565
by: Nicky | last post by:
Hi! I just wanted to know - what did Java 1.1 have that Java 1.0 didn't have? Was it JDBC and JavaBeans? When were the ORB APIs added to Java? Hope I'm not being too inquisitive.
3
34919
by: Leader | last post by:
Hi All, I am facing a problem with a sql what i used in MS Access but its not returning the same result in MS Sql Server 2000. Here i am giving the sql: SELECT TOP 3 format( MY_DATE, "dddd mm, yyyy" ) FROM MY_TAB WHERE MY_ID=1 The above sql in ACCESS return me the date in below format in one column:
4
5392
by: | last post by:
I have a stored procedure using a char(10), I need to specify that param in c#. What c# data type is can I use? I've looked around online for equivalents between sql types and c# types and couldn't find anything. I know this is basic, but i can't find the answer. thanks in advance.
2
1685
by: Carlitos | last post by:
Hi there, Does anybody know what would be the counterpart of Java's URL Class in .NET? Also, does anybody know a good web site or reference book that would give this kind of information (like a dictionary .NET-Java / Java-.NET)? Many thanks.
3
4039
by: tanya foster | last post by:
Hello, I am re-writing a visual basic .net application(visual studio 2003) in an asp.net application(visual studio 2005). The vb.net application relied on a treeview and hence, treenodes. The treeview and treenode class in asp.net is limited compared to vb.net's. In vb.net, the treenode had a nextnode property which was equivalent to finding the next sibling of the treenode. asp.net's treenode has a child property and a parent property....
1
1597
by: bhaskarguttikonda | last post by:
hi, pl tell me some of the java reporting tools ,which can access data from different databases regards, Bhaskar
2
2181
by: kutzi_lala_yey | last post by:
If You were hired by a gasoline firm to create a program that will tell whether which route is faster and which route is more likely to be fuel efficient separately. A test car was provided for you to model your software. This test car holds a full tank of 40 Liters and burns fuel at a rate of 7 Liters per kilometer. Your software should be able to ask two alternate routes from the user and its corresponding distances in kilometers. Assume...
2
8734
by: HaifaCarina | last post by:
i have this unfinished java program and i can't figure out what is the problem.. please help... /** * @(#)Answer3.java * * * @author * @version 1.00 2008/1/17
8
1789
by: COHENMARVIN | last post by:
I'm a VB programmer learning C#. One thing I don't know is how to test whether an object is 'null' or not. There is no 'null' keyword in C#. Why is that? CM
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10214
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10164
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9042
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7540
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.