Sharpen.RandomAccessFile.Read C# (CSharp) Method

Read() public method

public Read ( byte buffer ) : int
buffer byte
return int
        public int Read(byte[] buffer)
        {
            int r = stream.Read (buffer, 0, buffer.Length);
            return r > 0 ? r : -1;
        }

Same methods

RandomAccessFile::Read ( byte buffer, int start, int size ) : int

Usage Example

 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;
 }
All Usage Examples Of Sharpen.RandomAccessFile::Read