Here you can find the source of readFile(ZipInputStream zin)
public static String readFile(ZipInputStream zin) throws IOException
//package com.java2s; /*//from w w w .ja va2 s .c o m Bandika - A Java based modular Content Management System Copyright (C) 2009-2018 Michael Roennau This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. */ import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.util.zip.ZipInputStream; public class Main { public static String readFile(ZipInputStream zin) throws IOException { final char[] buffer = new char[0x2048]; StringBuilder out = new StringBuilder(); Reader in = new InputStreamReader(zin, "US-ASCII"); int read; while ((read = in.read(buffer, 0, buffer.length)) > 0) { out.append(buffer, 0, read); } String s = out.toString(); int startPos = 0; //check for utf-8 / endian start while (s.charAt(startPos) > 0xff) { startPos++; } if (startPos > 0) { s = s.substring(startPos); } return s; } }