public static void ToFile(IBitmapWrapper bitmap, string filename)
        {
            Stream stream = FileStreamFactory.New(filename, "rw");

            ToStream(bitmap, stream);
            stream.Dispose();
        }
        public static object FromFile(string filename)
        {
            var stream = FileStreamFactory.New(filename, "r");
            var img    = FromStream(stream);

            stream.Dispose();
            return(img);
        }
예제 #3
0
 /// <summary> Opens the file named 'fname' for writing the bit stream, using the 'he'
 /// header encoder. The magic number is written to the bit
 /// stream. Normally, the header encoder must be empty (i.e. no data has
 /// been written to it yet). A BufferedOutputStream is used on top of the
 /// file to increase throughput, the length of the buffer is DEF_BUF_LEN.
 ///
 /// </summary>
 /// <param name="fname">The name of file where to write the bit stream
 ///
 /// </param>
 /// <param name="mb">The maximum number of bytes that can be written to the bit
 /// stream.
 ///
 /// </param>
 /// <param name="encSpec">The encoder's specifications
 ///
 /// </param>
 /// <exception cref="IOException">If an error occurs while trying to open the file
 /// for writing or while writing the magic number.
 ///
 /// </exception>
 public FileCodestreamWriter(System.String fname, int mb) : base(mb)
 {
     //UPGRADE_TODO: Constructor 'java.io.FileOutputStream.FileOutputStream' was converted to 'System.IO.FileStream.FileStream' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioFileOutputStreamFileOutputStream_javalangString'"
     out_Renamed = FileStreamFactory.New(fname, "rw");
     initSOP_EPHArrays();
 }