Close() public method

public Close ( ) : void
return void
		public static PsdHeaderDirectory ProcessBytes(string file)
		{
			Com.Drew.Metadata.Metadata metadata = new Com.Drew.Metadata.Metadata();
			RandomAccessFile randomAccessFile = new RandomAccessFile(new FilePath(file), "r");
			new PsdReader().Extract(new RandomAccessFileReader(randomAccessFile), metadata);
			randomAccessFile.Close();
			PsdHeaderDirectory directory = metadata.GetDirectory<PsdHeaderDirectory>();
			NUnit.Framework.Assert.IsNotNull(directory);
			return directory;
		}
		public static Com.Drew.Metadata.Metadata ReadMetadata(FilePath file)
		{
			Com.Drew.Metadata.Metadata metadata = new Com.Drew.Metadata.Metadata();
			RandomAccessFile randomAccessFile = new RandomAccessFile(file, "r");
			try
			{
				new ExifReader().ExtractTiff(new RandomAccessFileReader(randomAccessFile), metadata);
			}
			finally
			{
				randomAccessFile.Close();
			}
			return metadata;
		}
示例#3
0
 public static Com.Drew.Metadata.Metadata ReadMetadata([NotNull] FilePath file)
 {
     Com.Drew.Metadata.Metadata metadata = new Com.Drew.Metadata.Metadata();
     RandomAccessFile randomAccessFile = new RandomAccessFile(file, "r");
     try
     {
         ExifTiffHandler handler = new ExifTiffHandler(metadata, false);
         new TiffReader().ProcessTiff(new RandomAccessFileReader(randomAccessFile), handler, 0);
     }
     finally
     {
         randomAccessFile.Close();
     }
     new FileMetadataReader().Read(file, metadata);
     return metadata;
 }
 public bool IsGZipped(BlobKey key)
 {
     var magic = 0;
     var path = PathForKey(key);
     var file = new FilePath(path);
     if (file.CanRead())
     {
         try
         {
             var raf = new RandomAccessFile(file, "r");
             magic = raf.Read() & unchecked((0xff)) | ((raf.Read() << 8) & unchecked((0xff00)));
             raf.Close();
         }
         catch (Exception e)
         {
             Runtime.PrintStackTrace(e, Console.Error);
         }
     }
     return magic == GZIPInputStream.GzipMagic;
 }
 public virtual bool IsGZipped(BlobKey key)
 {
     int magic = 0;
     string path = PathForKey(key);
     FilePath file = new FilePath(path);
     if (file.CanRead())
     {
         try
         {
             RandomAccessFile raf = new RandomAccessFile(file, "r");
             magic = raf.Read() & unchecked((int)(0xff)) | ((raf.Read() << 8) & unchecked((int
                 )(0xff00)));
             raf.Close();
         }
         catch (Exception e)
         {
             Sharpen.Runtime.PrintStackTrace(e, System.Console.Error);
         }
     }
     return magic == GZIPInputStream.GzipMagic;
 }
		/// <exception cref="System.IO.IOException"></exception>
		public override PackLock Parse(ProgressMonitor receiving, ProgressMonitor resolving
			)
		{
			tmpPack = FilePath.CreateTempFile("incoming_", ".pack", db.GetDirectory());
			tmpIdx = new FilePath(db.GetDirectory(), BaseName(tmpPack) + ".idx");
			try
			{
				@out = new RandomAccessFile(tmpPack, "rw");
				base.Parse(receiving, resolving);
				@out.Seek(packEnd);
				@out.Write(packHash);
				@out.GetChannel().Force(true);
				@out.Close();
				WriteIdx();
				tmpPack.SetReadOnly();
				tmpIdx.SetReadOnly();
				return RenameAndOpenPack(GetLockMessage());
			}
			finally
			{
				if (def != null)
				{
					def.Finish();
				}
				try
				{
					if (@out != null && @out.GetChannel().IsOpen())
					{
						@out.Close();
					}
				}
				catch (IOException)
				{
				}
				// Ignored. We want to delete the file.
				CleanupTemporaryFiles();
			}
		}