Re: Create a file from a binary stream
From: Lars-Inge Tønnessen [VJ# MVP] (http://emailme.larsinge.com)
Date: 12/27/04
- Next message: George Birbilis [MVP J#] [9880]: "Re: Importing files into the J# IDE"
- Previous message: Lars-Inge Tonnessen [VJ# MVP]: "Re: UI does not refresh"
- In reply to: raffaele: "Create a file from a binary stream"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 27 Dec 2004 19:44:10 +0100
Please try a binary serializable formater.
Somthing like this:
/** @attribute System.SerializableAttribute() */
public class test implements java.io.Serializable
{
public int number = 0;
}
public class Class1
{
public Class1()
{
try
{
test one = new test();
one.number = 10;
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formater =
new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
System.IO.Stream YourStream = new System.IO.FileStream( "path.bin",
System.IO.FileMode.Create,
System.IO.FileAccess.Write,
System.IO.FileShare.None);
formater.Serialize( YourStream, one );
}
catch ( Exception e )
{
System.Console.WriteLine( e.getMessage() );
}
}
/** @attribute System.STAThread() */
public static void main(String[] args)
{
new Class1();
}
}
Regards,
Lars-Inge Tønnessen
- Next message: George Birbilis [MVP J#] [9880]: "Re: Importing files into the J# IDE"
- Previous message: Lars-Inge Tonnessen [VJ# MVP]: "Re: UI does not refresh"
- In reply to: raffaele: "Create a file from a binary stream"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|