FlaterTest.java revision 0
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * This code is free software; you can redistribute it and/or modify it * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or * and causes slowness. This test uses Deflater and Inflater directly. * This test runs Inflater and Defalter in a number of simultaneous threads, * validating that the deflated & then inflated data matches the original private static final int DATA_LEN =
1024 *
128;
private static byte[]
data;
// If true, print extra info. private static final boolean debug =
false;
// Set of Flater threads running. /** Fill in {@code data} with random values. */ /** @return the length of the deflated {@code data}. */ /** Compares given bytes with those in {@code data}. * @throws Exception if given bytes don't match {@code data}. for (
int i =
0; i <
len; i++ ) {
/** Deflates and inflates data. */ /** Deflates and inflates {@code data}. */ /** Returns a copy of {@code data} in deflated form. */ /** Inflate a byte array, comparing it with {@code data} during * @throws Exception if inflated bytes don't match {@code data}. //--------------------- Infrastructure --------------------------- else fail(x +
" not equal to " + y);}