Lines Matching defs:data
27 * @summary Test that client-provided data in the extra field is written and
40 * Tests that the get/set operations on extra data in zip and jar files work
50 // ZipEntry extra data
82 /** Test that a header + data set by client works. */
86 byte[] data = new byte[b.length + 4];
87 set16(data, 0, TEST_HEADER);
88 set16(data, 2, b.length);
90 data[i + 4] = b[i];
92 ze.setExtra(data);
106 /** Test that a header only (i.e., no extra "data") set by client works. */
109 byte[] data = new byte[4];
110 set16(data, 0, TEST_HEADER);
111 set16(data, 2, 0); // Length of data is 0.
112 ze.setExtra(data);
125 /** Tests the client providing extra data which uses JAR_MAGIC header. */
128 byte[] data = new byte[8];
130 set16(data, 0, TEST_HEADER);
131 set16(data, 2, 0); // Length of data is 0.
132 set16(data, 4, JAR_MAGIC);
133 set16(data, 6, 0); // Length of data is 0.
135 ze.setExtra(data);
148 /** Check that the entry's extra data is correct. */
151 byte[] data = getField(TEST_HEADER, extraData);
152 if (!check(data != null, "unexpected null data for TEST_HEADER")) {
157 check(data.length == 0, "unexpected non-zero data length for TEST_HEADER");
159 check(Arrays.equals(extra[count], data),
161 + ", expected " + new String(extra[count]) + ", got '" + new String(data) + "'");
165 /** Look up descriptor in data, returning corresponding byte[]. */
166 static byte[] getField(int descriptor, byte[] data) {
170 while (i < data.length) {
171 if (get16(data, i) == descriptor) {
172 int length = get16(data, i + 2);
175 rc[j] = data[i + 4 + j];
179 i += get16(data, i + 2) + 4;
228 byte[] data = getField(JAR_MAGIC, extraData);
229 if (!check(data != null, "unexpected null data for JAR_MAGIC")) {
230 check(data.length != 0, "unexpected non-zero data length for JAR_MAGIC");