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; }