Exemplo n.º 1
0
        /// <exception cref="System.IO.IOException"/>
        public static InputStream WrapInputStreamForCompression(Configuration conf, string
                                                                codec, InputStream @in)
        {
            if (codec.IsEmpty())
            {
                return(@in);
            }
            FSImageCompression compression = FSImageCompression.CreateCompression(conf, codec
                                                                                  );
            CompressionCodec imageCodec = compression.GetImageCodec();

            return(imageCodec.CreateInputStream(@in));
        }
Exemplo n.º 2
0
        /// <summary>Save the fsimage to a temp file</summary>
        /// <exception cref="System.IO.IOException"/>
        private FilePath SaveFSImageToTempFile()
        {
            SaveNamespaceContext context = new SaveNamespaceContext(fsn, txid, new Canceler()
                                                                    );

            FSImageFormatProtobuf.Saver saver       = new FSImageFormatProtobuf.Saver(context);
            FSImageCompression          compression = FSImageCompression.CreateCompression(conf);
            FilePath imageFile = GetImageFile(testDir, txid);

            fsn.ReadLock();
            try
            {
                saver.Save(imageFile, compression);
            }
            finally
            {
                fsn.ReadUnlock();
            }
            return(imageFile);
        }