SharpDevelop Community

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

Unexpected EOF!

Last post 03-19-2017 8:10 PM by mimul. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 03-19-2017 8:10 PM

    • mimul
    • Not Ranked
    • Joined on 02-11-2017
    • Posts 2

    Unexpected EOF!

    Hello.

    I have a data matrix that i decode with zxing and what i get from it is encoded with java zip.Now im using sharpzip but every time i get un unexpected eof when it gets to GetNextEntry().

    Here is my code, i can't figure what im doing wrong:

         IBarcodeReader reader = new BarcodeReader();

                Bitmap bmp = new Bitmap("D:/scanate/scan.jpg");

                var result = reader.Decode(bmp);

                var tostring = result.ToString();

                byte[ toBytes = Encoding.UTF8.GetBytes(tostring);

                var unzip = UnzipArray(toBytes);

     

               public static byte[ UnzipArray(byte[ inputArray)

    {

         var buffer = new byte[Environment.Is64BitProcess ? 4096 : 2048];

     

        try

        {

            using (var outStream = new MemoryStream())

            {

               using (var inStream = new MemoryStream(inputArray))

                {

                    using (var zip = new ZipInputStream(inStream))

                    {

                        if (zip.GetNextEntry() != null)

                      {

                            int outSize = 0;

                           while ((outSize = zip.Read(buffer, 0, buffer.Length)) > 0)

                            {

                              outStream.Write(buffer, 0, outSize);

                           }                        

                        }

                    }

                }

                return outStream.ToArray();

           }

        }

        catch (Exception ex)

        {

            throw new ZipException(string.Format(Properties.Resources.ErrorUnzippingArray, "JavaZip", ex.Message));

        }

    }

    If someone can help me?

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