/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 4244499 4532049 4700978 4820807 4980042
* @summary Test ZipInputStream, ZipOutputStream and ZipFile with non-UTF8 encoding
*/
public class ZipCoding {
test("MS932",
"\u4e00\u4e01", "\uff67\uff68\uff69\uff6a\uff6b\uff6c");
test("ibm437",
"\u00e4\u00fc", "German Umlaut \u00fc in comment");
test("utf-8",
"\u4e00\u4e01", "\uff67\uff68\uff69\uff6a\uff6b\uff6c");
test("utf-8",
"\u00e4\u00fc", "German Umlaut \u00fc in comment");
test("utf-8",
"Surrogate\ud801\udc01", "Surrogates \ud800\udc00 in comment");
}
throws Exception
{
throw new RuntimeException("ZipIS name doesn't match!");
throw new RuntimeException("ZipIS content doesn't match!");
}
}
}
throws Exception
{
throw new RuntimeException("ZipFile: name/comment doesn't match!");
throw new RuntimeException("ZipFile: getIS failed!");
int n = 0;
int nn =0;
n += nn;
}
throw new RuntimeException("ZipFile content doesn't match!");
}
}
}
throws Exception
{
e.setComment(comment);
zos.putNextEntry(e);
zos.closeEntry();
}
// EFS should be set
}
"zfcoding.zip");
}
}
f.delete();
}
}