memorystream to java.io.ByteArrayOutputStream

This is a discussion on memorystream to java.io.ByteArrayOutputStream within the Tech Board forums, part of the Community Boards category; 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 ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21