C# to Java

Discussion in 'Java' started by J M, Oct 18, 2004.

  1. J M

    J M Guest

    I am manually porting C# program to Java

    How do I write following C# function in java
    using(MemoryStream memStream=new MemoryStream())

    TIA!
     
    J M, Oct 18, 2004
    #1
    1. Advertising

  2. J M wrote:
    > I am manually porting C# program to Java
    >
    > How do I write following C# function in java
    > using(MemoryStream memStream=new MemoryStream())
    >
    > TIA!


    Don't know C#, but my guess is ByteArrayOutputStream or
    ByteArrayInputStream. See
    <http://java.sun.com/j2se/1.4.2/docs/api/java/io/package-summary.html>

    --
    Thomas<dot>Fritsch<squiggle>ops<dot>de
     
    Thomas Fritsch, Oct 18, 2004
    #2
    1. Advertising

  3. "J M" <> wrote in message
    news:FVOcd.7334$q%...
    >I am manually porting C# program to Java
    >
    > How do I write following C# function in java
    > using(MemoryStream memStream=new MemoryStream())


    There's no Java class corresponding precisely to MemoryStream:
    ByteArrayInputStream and ByteArrayOutputStream are the closest.

    using(x) translates, more or less, to

    // declare x;
    try
    {
    // body of using statement
    }
    finally
    {
    // dispose of x in some class-specific fashion.
    // in the case, probably x.close();
    }
     
    Mike Schilling, Oct 18, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Novice
    Replies:
    1
    Views:
    1,202
    Mike Schilling
    Jul 19, 2003
  2. Michael Kintner
    Replies:
    0
    Views:
    871
    Michael Kintner
    Nov 30, 2003
  3. Ilias Lazaridis
    Replies:
    0
    Views:
    608
    Ilias Lazaridis
    Feb 1, 2005
  4. manish sahu
    Replies:
    3
    Views:
    1,038
  5. Isaac
    Replies:
    0
    Views:
    396
    Isaac
    Jan 20, 2011
Loading...

Share This Page