< prev index next >

test/java/util/zip/GZIP/Accordion.java

Print this page




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @bug 5092263
  26  * @summary GZIPInputStream o GZIPOutputStream === the identity stream
  27  * @author Martin Buchholz

  28 */
  29 
  30 // To manually test for uncompressed streams larger than 2GB, do
  31 // javac Accordion.java && java -server Accordion 3325349068
  32 // javac Accordion.java && java -server Accordion 5470735564
  33 
  34 import java.io.*;
  35 import java.util.*;
  36 import java.util.zip.GZIPInputStream;
  37 import java.util.zip.GZIPOutputStream;
  38 
  39 public class Accordion {
  40     private static void readFully(InputStream s, byte[] buf) throws Throwable {
  41         int pos = 0;
  42         int n;
  43         while ((n = s.read(buf, pos, buf.length-pos)) > 0)
  44             pos += n;
  45         if (pos != buf.length)
  46             throw new Exception("Unexpected EOF");
  47     }




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @bug 5092263
  26  * @summary GZIPInputStream o GZIPOutputStream === the identity stream
  27  * @author Martin Buchholz
  28  * @key randomness
  29 */
  30 
  31 // To manually test for uncompressed streams larger than 2GB, do
  32 // javac Accordion.java && java -server Accordion 3325349068
  33 // javac Accordion.java && java -server Accordion 5470735564
  34 
  35 import java.io.*;
  36 import java.util.*;
  37 import java.util.zip.GZIPInputStream;
  38 import java.util.zip.GZIPOutputStream;
  39 
  40 public class Accordion {
  41     private static void readFully(InputStream s, byte[] buf) throws Throwable {
  42         int pos = 0;
  43         int n;
  44         while ((n = s.read(buf, pos, buf.length-pos)) > 0)
  45             pos += n;
  46         if (pos != buf.length)
  47             throw new Exception("Unexpected EOF");
  48     }


< prev index next >