java2.util2.zip2.DeflaterOutputStream: 97.22%
Overview
Search Parameters
- plot: false
- chromosome_length: 40
- static_hack: false
- tournament_size: 10
- max_int: 2048
- string_length: 20
- crossover_rate: 0.75
- max_attempts: 1000
- CP: build/classes
- check_parents_length: true
- PREFIX: java2.util2.zip2
- stopping_condition: MaxStatements
- max_recursion: 10
- primitive_pool: 0.5
- selection_function: Rank
- generations: 10000000
- primitive_reuse_probability: 0.5
- test_excludes: test.excludes
- bloat_factor: 2
- object_reuse_probability: 0.9
- minimize: true
- html: true
- null_probability: 0.1
- strategy: EvoSuite
- elite: 1
- check_best_length: true
- num_tests: 2
- PROJECT_PREFIX: java2.util2.zip2
- OUTPUT_DIR: evosuite-files
- algorithm: SteadyStateGA
- string_replacement: true
- crossover_function: SinglePointRelative
- report_dir: evosuite-report
- test_includes: test.includes
- output_dir: evosuite-files
- criterion: branch
- rank_bias: 1.7
- timeout: 5000
- population: 100
- test_dir: evosuite-tests
- max_size: 100
- check_max_length: true
- TARGET_CLASS: java2.util2.zip2.DeflaterOutputStream
- check_rank_length: true
- max_length: 5000
- make_accessible: true
EvoSuite Parameters
- plot: false
- chromosome_length: 40
- static_hack: false
- tournament_size: 10
- max_int: 2048
- string_length: 20
- crossover_rate: 0.75
- max_attempts: 1000
- CP: build/classes
- check_parents_length: true
- PREFIX: java2.util2.zip2
- stopping_condition: MaxStatements
- max_recursion: 10
- primitive_pool: 0.5
- selection_function: Rank
- generations: 10000000
- primitive_reuse_probability: 0.5
- test_excludes: test.excludes
- bloat_factor: 2
- object_reuse_probability: 0.9
- minimize: true
- html: true
- null_probability: 0.1
- strategy: EvoSuite
- elite: 1
- check_best_length: true
- num_tests: 2
- PROJECT_PREFIX: java2.util2.zip2
- OUTPUT_DIR: evosuite-files
- algorithm: SteadyStateGA
- string_replacement: true
- crossover_function: SinglePointRelative
- report_dir: evosuite-report
- test_includes: test.includes
- output_dir: evosuite-files
- criterion: branch
- rank_bias: 1.7
- timeout: 5000
- population: 100
- test_dir: evosuite-tests
- max_size: 100
- check_max_length: true
- TARGET_CLASS: java2.util2.zip2.DeflaterOutputStream
- check_rank_length: true
- max_length: 5000
- make_accessible: true
Old Parameters
- Algorithm: SteadyStateGA
- Population size: 100
- Initial test length: 40
- Stopping condition: MaxStatements: null
- Bloat control factor: 2
- Random seed: 0
Statistics
- Start time: 2010-11-08 14:52:53
- End time: 2010-11-08 15:05:52
- Fitness evaluations: 1463124
- Tests executed: 851396
- Statements executed: 10000005
- Generations: 14632
- Number of tests before minimization: 2
- Number of tests after minimization: 2
- Length of tests before minimization: 21
- Length of tests after minimization: 21
- Total predicates: 14
- Total branches: 28
- Covered branches: 27
- Total methods: 8
- Covered methods: 8
- Methods without branches: 3
- Total coverage goal: 36
- Covered goals: 35
- Time for search: 0:12:58
- Time for minimization: 0:00:00
- Total time: 0:12:58
Test suite
Test case 1
1: ByteArrayOutputStream var0 = new java.io.ByteArrayOutputStream();;
2: Deflater var1 = new java.util.zip.Deflater();;
3: int var2 = 1078;;
4: DeflaterOutputStream var3 = new java2.util2.zip2.DeflaterOutputStream(var0, var1, var2);;
5: byte[] var4 = new byte[4];;
6: try {
7: var3.write(var4, var2, var4[0]);
8: } catch(IndexOutOfBoundsException e) {} // Raised exceptioncatch(IOException e) {} // Declared exception
9: DeflaterOutputStream var6 = null;
10: try {
11: var6 = new java2.util2.zip2.DeflaterOutputStream(var3, var1, var4[0]);
12: } catch(IllegalArgumentException e) {}
Test case 2
1: ByteArrayOutputStream var0 = new java.io.ByteArrayOutputStream();;
2: DeflaterOutputStream var1 = new java2.util2.zip2.DeflaterOutputStream(var0);;
3: DeflaterOutputStream var2 = null;
4: try {
5: var2 = new java2.util2.zip2.DeflaterOutputStream(var0, (Deflater) null);
6: } catch(NullPointerException e) {}
7: byte[] var3 = var1.buf;;
8: try {
9: var1.write(var3, var3[6], var3[0]);
10: }
11: catch(IOException e) {} // Declared exception;
12: DeflaterOutputStream var5 = null;
13: try {
14: var5 = new java2.util2.zip2.DeflaterOutputStream((OutputStream) null);
15: } catch(NullPointerException e) {}
16: try {
17: var1.close();
18: }
19: catch(IOException e) {} // Declared exception;
20: try {
21: var1.close();
22: }
23: catch(IOException e) {} // Declared exception;
24: DeflaterOutputStream var8 = new java2.util2.zip2.DeflaterOutputStream(var1);;
25: Deflater var9 = var1.def;;
26: DeflaterOutputStream var10 = new java2.util2.zip2.DeflaterOutputStream(var0, var9);;
27: try {
28: var8.write(var3[0]);
29: } catch(IOException e) {} // Raised exception
30: try {
31: var8.write(var3);
32: }
33: catch(IOException e) {} // Declared exception;
34: try {
35: var10.close();
36: }
37: catch(IOException e) {} // Declared exception;
Source Code
1: /*
2: * @(#)DeflaterOutputStream.java 1.37 10/03/23
3: *
4: * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
5: * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6: */
7:
8: package java2.util2.zip2;
9:
10: import java.io.FilterOutputStream;
11: import java.io.OutputStream;
12: import java.io.InputStream;
13: import java.io.IOException;
14:
15: import java.util.zip.Deflater;
16:
17: /**
18: * This class implements an output stream filter for compressing data in
19: * the "deflate" compression format. It is also used as the basis for other
20: * types of compression filters, such as GZIPOutputStream.
21: *
22: * @see Deflater
23: * @version 1.37, 03/23/10
24: * @author David Connelly
25: */
26: public
27: class DeflaterOutputStream extends FilterOutputStream {
28: /**
29: * Compressor for this stream.
30: */
31: protected Deflater def;
32:
33: /**
34: * Output buffer for writing compressed data.
35: */
36: protected byte[] buf;
37:
38: /**
39: * Indicates that the stream has been closed.
40: */
41:
42: private boolean closed = false;
43:
44: /**
45: * Creates a new output stream with the specified compressor and
46: * buffer size.
47: * @param out the output stream
48: * @param def the compressor ("deflater")
49: * @param size the output buffer size
50: * @exception IllegalArgumentException if size is <= 0
51: */
52: public DeflaterOutputStream(OutputStream out, Deflater def, int size) {
53: super(out);
54: if (out == null || def == null) {
55: throw new NullPointerException();
56: } else if (size <= 0) {
57: throw new IllegalArgumentException("buffer size <= 0");
58: }
59: this.def = def;
60: buf = new byte[size];
61: }
62:
63: /**
64: * Creates a new output stream with the specified compressor and
65: * a default buffer size.
66: * @param out the output stream
67: * @param def the compressor ("deflater")
68: */
69: public DeflaterOutputStream(OutputStream out, Deflater def) {
70: this(out, def, 512);
71: }
72:
73: boolean usesDefaultDeflater = false;
74:
75: /**
76: * Creates a new output stream with a default compressor and buffer size.
77: * @param out the output stream
78: */
79: public DeflaterOutputStream(OutputStream out) {
80: this(out, new Deflater());
81: usesDefaultDeflater = true;
82: }
83:
84: /**
85: * Writes a byte to the compressed output stream. This method will
86: * block until the byte can be written.
87: * @param b the byte to be written
88: * @exception IOException if an I/O error has occurred
89: */
90: public void write(int b) throws IOException {
91: byte[] buf = new byte[1];
92: buf[0] = (byte)(b & 0xff);
93: write(buf, 0, 1);
94: }
95:
96: /**
97: * Writes an array of bytes to the compressed output stream. This
98: * method will block until all the bytes are written.
99: * @param b the data to be written
100: * @param off the start offset of the data
101: * @param len the length of the data
102: * @exception IOException if an I/O error has occurred
103: */
104: public void write(byte[] b, int off, int len) throws IOException {
105: if (def.finished()) {
106: throw new IOException("write beyond end of stream");
107: }
108: if ((off | len | (off + len) | (b.length - (off + len))) < 0) {
109: throw new IndexOutOfBoundsException();
110: } else if (len == 0) {
111: return;
112: }
113: if (!def.finished()) {
114: // Deflate no more than stride bytes at a time. This avoids
115: // excess copying in deflateBytes (see Deflater.c)
116: int stride = buf.length;
117: for (int i = 0; i < len; i+= stride) {
118: def.setInput(b, off + i, Math.min(stride, len - i));
119: while (!def.needsInput()) {
120: deflate();
121: }
122: }
123: }
124: }
125:
126: /**
127: * Finishes writing compressed data to the output stream without closing
128: * the underlying stream. Use this method when applying multiple filters
129: * in succession to the same output stream.
130: * @exception IOException if an I/O error has occurred
131: */
132: public void finish() throws IOException {
133: if (!def.finished()) {
134: def.finish();
135: while (!def.finished()) {
136: deflate();
137: }
138: }
139: }
140:
141: /**
142: * Writes remaining compressed data to the output stream and closes the
143: * underlying stream.
144: * @exception IOException if an I/O error has occurred
145: */
146: public void close() throws IOException {
147: if (!closed) {
148: finish();
149: if (usesDefaultDeflater)
150: def.end();
151: out.close();
152: closed = true;
153: }
154: }
155:
156: /**
157: * Writes next block of compressed data to the output stream.
158: * @throws IOException if an I/O error has occurred
159: */
160: protected void deflate() throws IOException {
161: int len = def.deflate(buf, 0, buf.length);
162: if (len > 0) {
163: out.write(buf, 0, len);
164: }
165: }
166: }