Read varbinary data in java
Hello,
I made a android application which read some files from SQL server. Those files saved to a varbinary(MAX) field in SQL Server by a third party web service. My problem is that when I want to read those files by my java application, those binary data shows deferent content in java application. In fact I read data byte by byte and I configure that some bytes couldn’t show real values which saved in the data base. I find out that what the problem is, but I couldn’t find a solution yet. I find out that in the web service every varbinary data saves to database as byte data (in .Net each byte takes 0 to 255). But when I want to read the binary data in java, it takes deferent values and cause exception in some values. Because in java byte value takes -127 to 127.
In my java application I want to write those data to a file by OutputStream.write(byte[]) method. How can I solve this problem? I think that I have to find a way to convert c# byte[] to java byte[] (or binary data), but how can I do that?
Regards…
Re: Read varbinary data in java