title: Decompressed stream to stream reader
body: <p>I get <code>Stream was not readable</code> when attempting to return a decompressed stream from the follwoing code.</p>
  
  <pre><code>    Using strmReader As New StreamReader(FileOpenRead(strFullFilename))
      ...
      End using
  </code></pre>
  
  <p>When calling the following code:</p>
  
  <pre><code>Public Function FileOpenRead(ByVal strFullFilename As String) As Stream
  
          If File.Exists(strFullFilename) Then
  
              If Path.GetExtension(strFullFilename) = zipExtension Then
                  Return DecompressToStream(strFullFilename)
              Else
                  Return File.Open(strFullFilename, FileMode.Open, FileAccess.Read, FileShare.Read)
              End If
          End If
          Return Nothing
      End Function
  
  Private Function DecompressToStream(ByVal strFullFilename As String) As Stream
  
          Dim strmDecompressed As Stream = Nothing
  
          If File.Exists(strFullFilename) Then
              Using inpFile As FileStream = File.OpenRead(strFullFilename)
                  Using Decompress As New GZipStream(inpFile, CompressionMode.Decompress)
                      strmDecompressed = New BufferedStream(Decompress)
                  End Using
              End Using
          End If
  
          Return strmDecompressed
      End Function
  </code></pre>
  
  <p>I'm using the 3.5 framework, can anyone help me with the best way to return a decompressed stream?</p>