Thread: memorystream to java.io.ByteArrayOutputStream

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    141

    memorystream to java.io.ByteArrayOutputStream

    Hi,

    I've written a function to convert a java.io.ByteArrayOutputStream to a Memorystream and it works. As:
    Code:
    public MemoryStream baosToStream(java.io.ByteArrayOutputStream  baos)
            {
                sbyte[] buff = baos.toByteArray();
                byte[] outputBuff = new byte[buff.Length];
                for (int index = 0; index < buff.Length; index++)
                {
                    outputBuff[index] = (byte)buff[index];
                }
                MemoryStream ms = new MemoryStream(outputBuff);
                return ms;
            }
    Now I want to go the other way i.e. MemoryStream to java.io.ByteArrayOutputStream and I can't .
    Any suggestions?

    Angkar

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    What's Java got to do with c# ?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Dec 2005
    Posts
    141
    I need to do a conversion since I use a .dll present in Java which is not in C#

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Find a friendly Java board and ask there?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BinaryReader
    By gotclout in forum C# Programming
    Replies: 6
    Last Post: 04-29-2008, 10:52 PM
  2. memorystream query
    By AngKar in forum C# Programming
    Replies: 1
    Last Post: 06-22-2006, 11:47 AM
  3. Getting type
    By AngKar in forum C# Programming
    Replies: 3
    Last Post: 05-26-2006, 09:06 AM