473,769 Members | 5,869 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Conversion from Stream to SByte

Hi,

Problem statement: Calling a java method from Dot Net code that returns a
java byte array.

Overview: I have a java server from which I need to establish connection. I
hva ebeen able to send across data to the server in a serialised stream.
However, when I need to geta response back to the client (.Net), I get a
binary stream. What I wanna do is to convert this stream into an SByte array
(The java byte is actually a signed byte, the System.SByte object). This
SByte array then gets passed into the java method which would give me an
object.

Hurdles: I am unable to convert the Stream into a byte array. (To convert
this byte array into an SByte array, I have created a function). Ideally, if
I could convert this stream into an SByte itself, instead of having to use
this function, it would be great. Have been googling for quite some time, but
have been unsuccessful so far. Could someone please help me out on this???

Anticipating,
Nick
Jul 22 '05 #1
2 3713
Nick <Ni**@discussio ns.microsoft.co m> wrote:
Problem statement: Calling a java method from Dot Net code that returns a
java byte array.

Overview: I have a java server from which I need to establish connection. I
hva ebeen able to send across data to the server in a serialised stream.
However, when I need to geta response back to the client (.Net), I get a
binary stream. What I wanna do is to convert this stream into an SByte array
(The java byte is actually a signed byte, the System.SByte object). This
SByte array then gets passed into the java method which would give me an
object.

Hurdles: I am unable to convert the Stream into a byte array. (To convert
this byte array into an SByte array, I have created a function). Ideally, if
I could convert this stream into an SByte itself, instead of having to use
this function, it would be great. Have been googling for quite some time, but
have been unsuccessful so far. Could someone please help me out on this???


See http://www.pobox.com/~skeet/csharp/readbinary.html

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 22 '05 #2
I was able to get it done alright...
Cheers!

"Jon Skeet [C# MVP]" wrote:
Nick <Ni**@discussio ns.microsoft.co m> wrote:
Problem statement: Calling a java method from Dot Net code that returns a
java byte array.

Overview: I have a java server from which I need to establish connection. I
hva ebeen able to send across data to the server in a serialised stream.
However, when I need to geta response back to the client (.Net), I get a
binary stream. What I wanna do is to convert this stream into an SByte array
(The java byte is actually a signed byte, the System.SByte object). This
SByte array then gets passed into the java method which would give me an
object.

Hurdles: I am unable to convert the Stream into a byte array. (To convert
this byte array into an SByte array, I have created a function). Ideally, if
I could convert this stream into an SByte itself, instead of having to use
this function, it would be great. Have been googling for quite some time, but
have been unsuccessful so far. Could someone please help me out on this???


See http://www.pobox.com/~skeet/csharp/readbinary.html

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Jul 22 '05 #3

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

Similar topics

3
1312
by: Stephen Gennard | last post by:
Hello, I having a problem dynamically invoking a static method that takes a reference to a SByte*. If I do it directly it works just fine. Anyone any ideas why? I have include a example below... --
3
2197
by: Steve - DND | last post by:
After downloading and using two different memory profiling applications today, it seems that sbyte, int16, and int32 are all stored using 12b of memory. Someone please tell me I'm reading these memory profilers wrong! If I'm really reading it correctly, then what's the point of using anything other than a 32 bit integer? If they're all going to be stored the same way, then I can't achieve any memory savings(which I was really hoping for) by...
0
1194
by: Enosh Chang | last post by:
Hi, I encounter one problem about System.IO. I have a binary file that contains following structure, struct MyFormat { public sbyte Type; public sbyte Num; public sbyte Flag;
2
7763
by: acerblue | last post by:
Hi, I've an array of sbyte with null char termination. I'd like to convert it to string type. How can I do that ? Thanks ssggys
5
8514
by: Pat Ireland | last post by:
I am attempting to pass an SByte to another .NET class that expects the data to be passed as SByte *. I searched around and found the boxing can be used to produce a pointer but I'm not sure if this is appropriate. I am using the following sequence: // Load class Assembly c = Assembl.LoadFrom("filename ....); // Get the types cTypes = c.GetTypes();
2
253
by: Nick | last post by:
Hi, Problem statement: Calling a java method from Dot Net code that returns a java byte array. Overview: I have a java server from which I need to establish connection. I hva ebeen able to send across data to the server in a serialised stream. However, when I need to geta response back to the client (.Net), I get a binary stream. What I wanna do is to convert this stream into an SByte array (The java byte is actually a signed byte,...
5
2302
by: Pavils Jurjans | last post by:
Hello, I am somewhat lost in the implicit/expicit possible/impossible type casting in C#... I need to write a class, which among other things, must have wat to read a numeric value type, and internally convert it so that it could be saved in database as real number (float). I plan to provide property(set) interface for reading the value.
16
8787
by: pkoniusz | last post by:
Hello everybody, Been just thinking how actually one could convert the following unmanaged code to the managed C++: struct JustAnExample { char value1; int value2; // etc ....
8
18286
by: =?Utf-8?B?Q2hyaXMgRmluaw==?= | last post by:
I am trying to make a minor modification to the code below and need some assistance. Currently this code is using the java.util, java.util.zip, and java.io assemblies from the vjslib.dll assembly. This code works fine by taking file(s) from disk and creating a zip file to disk. I need to modify this code to read a file from a byte array and then output the zip file to a byte array (all done in memory instead of disk). The reason for...
0
9579
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
9416
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
10199
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9979
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
9849
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6661
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
5433
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3551
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2810
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.