title: Converting inputStream from a ZipFile to String
body: <p>Here the main functionality of my web application is to upload .zip file and store it at the server side but before doing that I need to do some following task:
  1.) .zip file contains the xml file, I have to first validate the xml file using schema.
  2.) if the xml file is valid than I need to convert the content of the xml file into string without unzipping the file i.e. from the inputstream.</p>
  
  <p>I am successfull in validating the xml file but I am getting the following exception while converting the string from the inputstream:
  <strong>"java.io.EOFException: Unexpected end of ZLIB input stream"</strong></p>
  
  <p>I have tried all the solutions provided in the Stack Overflow and other forum site but I am not yet successfull. Any help will be really appreciated:</p>
  
  <p>Following is the code:</p>
  
  <pre><code>try
      {
          ZipFile zipFileUtil = new ZipFile(zipFile);
          Enumeration&lt;? extends ZipEntry&gt; zipFileContents = zipFileUtil.entries();
          while(zipFileContents.hasMoreElements())
          {
  
              ZipEntry zipEntry = zipFileContents.nextElement();
              if(zipEntry.getName().equals("File.xml"))
              {
                  InputStream sourceFile = zipFileUtil.getInputStream(zipEntry);
                  if(isValidAsPerXSD(sourceFile))
                  {
                      //At this line Exception is Generated
                      String xmlContent = IOUtils.toString(sourceFile);
                  }
              }
          }
  
      }
      catch(Throwable t)
      {
          System.out.println("Exception: "+t.getMessage());
      }
  </code></pre>