SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

ZipInputStream.Read error: Unable to read from this stream

Last post 07-28-2008 1:20 PM by mohunt. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 07-22-2008 10:31 PM

    • mohunt
    • Not Ranked
    • Joined on 07-22-2008
    • Posts 4

    ZipInputStream.Read error: Unable to read from this stream

     

     The ZipInputStream objects read method is returning the following message when I try to inflate from a byte array. 

     Unable to read from this stream

    My code is below: 

    Public Shared Function Uncompress_Memory_Data(ByVal bData As Byte()) As Byte()

            Dim strmZipInputStream As ZipInputStream = Nothing
            Dim strmData As MemoryStream
            Dim bResult As Byte() = Nothing
            Dim bTemp As Byte() = Nothing
            Dim iReadSize As Integer = 2048
            Dim iRead As Integer = 0
            Dim iOffset As Integer = 0

            Try
                ' Simple sanity checks
                If bData.Length = 0 Then
                    m_Error_Message = "DataCompression.Uncompress_Memory_Data: No data to uncompress."
                Else
                    strmData = New MemoryStream(bData)
                    strmData.Position = 0
                    strmZipInputStream = New ZipInputStream(strmData)
                    ReDim bTemp(iReadSize)
                    Do While True
                        iRead = strmZipInputStream.Read(bTemp, 0, bTemp.Length)
                        If iRead = 0 Then
                            Exit Do
                        End If
                        Array.Copy(bTemp, 0, bResult, iOffset, iRead)
                        iOffset += iRead
                    Loop
                End If
                strmZipInputStream.Close()

            Catch ex As Exception
                m_Error_Message = "DataCompression.Uncompress_Memory_Data " & ex.Message
                bResult = Nothing
            Finally
                strmData = Nothing
                strmZipInputStream = Nothing
                bTemp = Nothing
            End Try

            Return bResult

        End Function

    Any help would be appreciated.

    Thank you

    Filed under:
  • 07-23-2008 3:49 PM In reply to

    • mohunt
    • Not Ranked
    • Joined on 07-22-2008
    • Posts 4

    Re: ZipInputStream.Read error: Unable to read from this stream

    I have found that after the   "strmZipInputStream = New ZipInputStream(strmData)' statement the ZipInputStream.Available property is equal to 0.

     Does anyone know what could cause this?

    Thank you 


     

  • 07-24-2008 3:20 PM In reply to

    • mohunt
    • Not Ranked
    • Joined on 07-22-2008
    • Posts 4

    Re: ZipInputStream.Read error: Unable to read from this stream

    The following is a hex dump of the data I am trying to decompress:

    78 9C 33 68 62 FE 60 D0 C4 74 63 1 33 13 23 13 13 13 47 81 1 2F 1B A7 56 9B 47 DB 77 5E 46 46 56 56 6 83 28 43 6E 3 4E 36 E6 50 16 36 61 A6 D0 60 43 9 3 31 10 87 4B 98 3F 54 2F 58 4F C1 3D BF 2C B5 28 2F 37 35 AF C4 90 C7 80 B 24 C3 2D CC EC E2 EF 82 C4 B F0 F6 34 14 35 10 6 F1 98 85 79 80 72 A FE BE A CE 8E BA 46 6 6 72 E2 BC 6 16 6 E6 6 86 6 60 10 25 CE 6B 68 68 60 66 6C 60 64 6C 6A 69 6A 19 65 50 40 86 DD F9 E8 76 23 78 A1 C1 8E 86 B2 6 D2 10 97 88 F8 BB B8 FA E9 F9 3A 6 39 EB 19 1A 9A 19 18 9A 1A 9B 1 DD D2 38 1F D9 FF 8C AC C CC 8D BD C 6 8D 9D 4C 8D 8D C E7 6C 8E 70 39 FC 12 10 AA 50 7F F2 D4 CA A8 78 91 FE EC 9 9F 37 AB 87 99 8B 4D BD 29 1A B5 FA F8 8F F6 38 F5 63 91 6F E5 36 37 8A BF 29 5F F5 71 5B 8E BD 1C D7 3F 67 AB 5F 87 CF B DC 65 B9 60 24 3A 53 FA B5 7E 7B FF A3 E AD 1F 53 F 7F E9 7A FA 8C BB 68 4E 81 D8 91 85 CF 96 BE 38 7B 7F 3A 4B 75 9A 6E 50 9C B5 44 A1 8B C6 CC A3 9B B6 2C F4 E0 FA 51 35 7F B1 BE 33 F AB CA 43 F5 E0 F DB D4 33 AA 52 99 98 19 19 18 17 37 31 EA 18 34 31 6A 18 F0 1 BD 21 CB CF C8 F8 9F 85 85 99 89 ED 80 81 3C 88 AF CC 2 C A3 6 91 3D C2 D1 67 9E 2F DA 61 FA 28 B4 F9 C3 C1 29 52 19 D7 73 B7 EC 35 90 5 29 E0 63 11 63 11 59 BA 6C 9D DD 9A 4B A9 B7 62 8B B5 1F 88 C9 9D 10 B2 5F 76 F2 20 38 68 65 15 58 F8 D 78 D B8 D9 38 13 DA 3C 18 53 99 18 B9 39 D 1C 40 E2 F2 2C 96 C0 68 32 5D 60 BC C0 B0 4D 3F A3 A4 A4 C0 4A 5F 3F B9 28 47 2F 2F B3 44 2F 25 B3 38 51 2F 37 33 47 3F 3D B5 4 28 66 F 8C 61 55 23 3 7F 5F 20 1 89 E5 1A 36 E 6D 36 60 5A 62 67 64 64 29 30 C8 33 B0 81 F1 D 98 DA C F0 18 56 9C 99 9E 87 69 9A 1E 5C 37 63 9B 12 54 77 7E 72 71 81 5E 5E 71 9E 81 5E 51 72 59 31 8A 41 68 C9 99 B9 89 91 91 81 35 DD 66 E6 B6 2F 7 39 1E 88 1C 3E B4 B1 8F 3F D3 77 86 64 59 7B DC CF 1A E6 E2 B7 25 1B C4 3F 4F 76 AD 35 FA 10 9B A3 94 61 72 FE E1 37 CE 2D 3D 96 D7 26 BE 51 CE 76 FE 54 3E CB 63 12 E3 6D 96 DF D2 56 2F 1E 39 3C 66 49 FE A1 BD E5 75 A5 FD AD 3B 5 F1 C 71 8D 1D 22 EE CB AC 76 EC 5B 97 FA 53 DF 57 ED F8 E3 2B CF 79 8B AE B5 65 1D B9 58 F2 6A DE A1 3 C 1B E E6 A8 B9 46 45 5F 9C 3E E1 CE C1 88 A4 25 9E C6 1B 8D 6F 5E BA 1D BD A0 C4 3F 7C 5E DF AE F9 4E 8A 22 C1 F1 3B EF AD 12 12 66 57 CF B8 B1 5F F6 FC A3 94 54 C6 ED 13 B6 ED 9F 56 A6 5C EC F9 EE 50 F8 8C EC 18 CB 36 B7 3F FB F4 8F 3B 7A 6E 8B B5 E7 9F E2 B6 CD 5A B9 20 3D 9F 65 9E 84 EC 62 5B 87 46 C5 FD 9B BB 9A FF 3C 52 9B AB B7 B6 A7 D6 B1 ED D0 CC 83 D BA 5E C6 B F9 F7 98 C6 16 DE E7 FC FE 7B C5 2F D5 D4 E0 A8 CD 3B F2 62 16 9E 9F F0 2 0 16 9C 4E B2 

     

  • 07-27-2008 3:44 AM In reply to

    Re: ZipInputStream.Read error: Unable to read from this stream

    Hi,

    You should check out the samples to see how to use the library.  You need to get an entry before you can read from the stream.  The ZipInputStream class is not a simple stream at all as the data is structured.

     

    hth,

    -jr-

  • 07-27-2008 3:51 AM In reply to

    Re: ZipInputStream.Read error: Unable to read from this stream

    This doesnt look like a zip file...

  • 07-28-2008 1:20 PM In reply to

    • mohunt
    • Not Ranked
    • Joined on 07-22-2008
    • Posts 4

    Re: ZipInputStream.Read error: Unable to read from this stream

    It is a data stream compresed using zlib.  From what I understand now; I should up the inflater method. Do you have any examples of using this method?

Page 1 of 1 (6 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.