| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
package org.apache.hadoop.hive.contrib.util.typedbytes; |
| 20 |
|
|
| 21 |
|
import java.io.DataInput; |
| 22 |
|
import java.io.EOFException; |
| 23 |
|
import java.io.IOException; |
| 24 |
|
import java.util.ArrayList; |
| 25 |
|
import java.util.List; |
| 26 |
|
import java.util.TreeMap; |
| 27 |
|
|
| 28 |
|
import org.apache.hadoop.io.WritableUtils; |
| 29 |
|
import org.apache.hadoop.record.Buffer; |
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
|
|
|
| 6.5% |
Uncovered Elements: 260 (278) |
Complexity: 74 |
Complexity Density: 0.42 |
|
| 34 |
|
public class TypedBytesInput { |
| 35 |
|
|
| 36 |
|
private DataInput in; |
| 37 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 38 |
0
|
private TypedBytesInput() {... |
| 39 |
|
} |
| 40 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 41 |
0
|
private void setDataInput(DataInput in) {... |
| 42 |
0
|
this.in = in; |
| 43 |
|
} |
| 44 |
|
|
| 45 |
|
private static ThreadLocal tbIn = new ThreadLocal() { |
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 46 |
0
|
@Override... |
| 47 |
|
protected synchronized Object initialValue() { |
| 48 |
0
|
return new TypedBytesInput(); |
| 49 |
|
} |
| 50 |
|
}; |
| 51 |
|
|
| 52 |
|
|
| 53 |
|
@link |
| 54 |
|
|
| 55 |
|
@param |
| 56 |
|
|
| 57 |
|
@return@link |
| 58 |
|
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 59 |
0
|
public static TypedBytesInput get(DataInput in) {... |
| 60 |
0
|
TypedBytesInput bin = (TypedBytesInput) tbIn.get(); |
| 61 |
0
|
bin.setDataInput(in); |
| 62 |
0
|
return bin; |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 66 |
63
|
public TypedBytesInput(DataInput in) {... |
| 67 |
63
|
this.in = in; |
| 68 |
|
} |
| 69 |
|
|
| 70 |
|
|
| 71 |
|
|
| 72 |
|
|
| 73 |
|
|
| 74 |
|
|
| 75 |
|
@return |
| 76 |
|
@throws |
| 77 |
|
|
|
|
|
| 0% |
Uncovered Elements: 61 (61) |
Complexity: 17 |
Complexity Density: 0.52 |
|
| 78 |
0
|
public Object read() throws IOException {... |
| 79 |
0
|
int code = 1; |
| 80 |
0
|
try { |
| 81 |
0
|
code = in.readUnsignedByte(); |
| 82 |
|
} catch (EOFException eof) { |
| 83 |
0
|
return null; |
| 84 |
|
} |
| 85 |
0
|
if (code == Type.BYTES.code) { |
| 86 |
0
|
return new Buffer(readBytes()); |
| 87 |
0
|
} else if (code == Type.BYTE.code) { |
| 88 |
0
|
return readByte(); |
| 89 |
0
|
} else if (code == Type.BOOL.code) { |
| 90 |
0
|
return readBool(); |
| 91 |
0
|
} else if (code == Type.INT.code) { |
| 92 |
0
|
return readInt(); |
| 93 |
0
|
} else if (code == Type.SHORT.code) { |
| 94 |
0
|
return readShort(); |
| 95 |
0
|
} else if (code == Type.LONG.code) { |
| 96 |
0
|
return readLong(); |
| 97 |
0
|
} else if (code == Type.FLOAT.code) { |
| 98 |
0
|
return readFloat(); |
| 99 |
0
|
} else if (code == Type.DOUBLE.code) { |
| 100 |
0
|
return readDouble(); |
| 101 |
0
|
} else if (code == Type.STRING.code) { |
| 102 |
0
|
return readString(); |
| 103 |
0
|
} else if (code == Type.VECTOR.code) { |
| 104 |
0
|
return readVector(); |
| 105 |
0
|
} else if (code == Type.LIST.code) { |
| 106 |
0
|
return readList(); |
| 107 |
0
|
} else if (code == Type.MAP.code) { |
| 108 |
0
|
return readMap(); |
| 109 |
0
|
} else if (code == Type.MARKER.code) { |
| 110 |
0
|
return null; |
| 111 |
0
|
} else if (50 <= code && code <= 200) { |
| 112 |
0
|
return new Buffer(readBytes()); |
| 113 |
|
} else { |
| 114 |
0
|
throw new RuntimeException("unknown type"); |
| 115 |
|
} |
| 116 |
|
} |
| 117 |
|
|
| 118 |
|
|
| 119 |
|
|
| 120 |
|
|
| 121 |
|
|
| 122 |
|
|
| 123 |
|
@return |
| 124 |
|
|
| 125 |
|
@throws |
| 126 |
|
|
|
|
|
| 0% |
Uncovered Elements: 57 (57) |
Complexity: 16 |
Complexity Density: 0.52 |
|
| 127 |
0
|
public byte[] readRaw() throws IOException {... |
| 128 |
0
|
int code = -1; |
| 129 |
0
|
try { |
| 130 |
0
|
code = in.readUnsignedByte(); |
| 131 |
|
} catch (EOFException eof) { |
| 132 |
0
|
return null; |
| 133 |
|
} |
| 134 |
0
|
if (code == Type.BYTES.code) { |
| 135 |
0
|
return readRawBytes(); |
| 136 |
0
|
} else if (code == Type.BYTE.code) { |
| 137 |
0
|
return readRawByte(); |
| 138 |
0
|
} else if (code == Type.BOOL.code) { |
| 139 |
0
|
return readRawBool(); |
| 140 |
0
|
} else if (code == Type.INT.code) { |
| 141 |
0
|
return readRawInt(); |
| 142 |
0
|
} else if (code == Type.LONG.code) { |
| 143 |
0
|
return readRawLong(); |
| 144 |
0
|
} else if (code == Type.FLOAT.code) { |
| 145 |
0
|
return readRawFloat(); |
| 146 |
0
|
} else if (code == Type.DOUBLE.code) { |
| 147 |
0
|
return readRawDouble(); |
| 148 |
0
|
} else if (code == Type.STRING.code) { |
| 149 |
0
|
return readRawString(); |
| 150 |
0
|
} else if (code == Type.VECTOR.code) { |
| 151 |
0
|
return readRawVector(); |
| 152 |
0
|
} else if (code == Type.LIST.code) { |
| 153 |
0
|
return readRawList(); |
| 154 |
0
|
} else if (code == Type.MAP.code) { |
| 155 |
0
|
return readRawMap(); |
| 156 |
0
|
} else if (code == Type.MARKER.code) { |
| 157 |
0
|
return null; |
| 158 |
0
|
} else if (50 <= code && code <= 200) { |
| 159 |
0
|
return readRawBytes(); |
| 160 |
|
} else { |
| 161 |
0
|
throw new RuntimeException("unknown type"); |
| 162 |
|
} |
| 163 |
|
} |
| 164 |
|
|
| 165 |
|
|
| 166 |
|
@link |
| 167 |
|
|
| 168 |
|
@return |
| 169 |
|
@throws |
| 170 |
|
|
|
|
|
| 90% |
Uncovered Elements: 1 (10) |
Complexity: 3 |
Complexity Density: 0.38 |
|
| 171 |
12425
|
public Type readType() throws IOException {... |
| 172 |
12425
|
int code = -1; |
| 173 |
12425
|
try { |
| 174 |
12425
|
code = in.readUnsignedByte(); |
| 175 |
|
} catch (EOFException eof) { |
| 176 |
4
|
return null; |
| 177 |
|
} |
| 178 |
12421
|
for (Type type : Type.values()) { |
| 179 |
130455
|
if (type.code == code) { |
| 180 |
12421
|
return type; |
| 181 |
|
} |
| 182 |
|
} |
| 183 |
0
|
return null; |
| 184 |
|
} |
| 185 |
|
|
| 186 |
|
|
| 187 |
|
|
| 188 |
|
|
| 189 |
|
@return |
| 190 |
|
@throws |
| 191 |
|
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 192 |
0
|
public boolean skipType() throws IOException {... |
| 193 |
0
|
try { |
| 194 |
0
|
in.readByte(); |
| 195 |
0
|
return true; |
| 196 |
|
} catch (EOFException eof) { |
| 197 |
0
|
return false; |
| 198 |
|
} |
| 199 |
|
} |
| 200 |
|
|
| 201 |
|
|
| 202 |
|
|
| 203 |
|
|
| 204 |
|
@return |
| 205 |
|
@throws |
| 206 |
|
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 207 |
0
|
public byte[] readBytes() throws IOException {... |
| 208 |
0
|
int length = in.readInt(); |
| 209 |
0
|
byte[] bytes = new byte[length]; |
| 210 |
0
|
in.readFully(bytes); |
| 211 |
0
|
return bytes; |
| 212 |
|
} |
| 213 |
|
|
| 214 |
|
|
| 215 |
|
|
| 216 |
|
|
| 217 |
|
@return |
| 218 |
|
@throws |
| 219 |
|
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
|
| 220 |
0
|
public byte[] readRawBytes() throws IOException {... |
| 221 |
0
|
int length = in.readInt(); |
| 222 |
0
|
byte[] bytes = new byte[5 + length]; |
| 223 |
0
|
bytes[0] = (byte) Type.BYTES.code; |
| 224 |
0
|
bytes[1] = (byte) (0xff & (length >> 24)); |
| 225 |
0
|
bytes[2] = (byte) (0xff & (length >> 16)); |
| 226 |
0
|
bytes[3] = (byte) (0xff & (length >> 8)); |
| 227 |
0
|
bytes[4] = (byte) (0xff & length); |
| 228 |
0
|
in.readFully(bytes, 5, length); |
| 229 |
0
|
return bytes; |
| 230 |
|
} |
| 231 |
|
|
| 232 |
|
|
| 233 |
|
|
| 234 |
|
|
| 235 |
|
@return |
| 236 |
|
@throws |
| 237 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 238 |
84
|
public byte readByte() throws IOException {... |
| 239 |
84
|
return in.readByte(); |
| 240 |
|
} |
| 241 |
|
|
| 242 |
|
|
| 243 |
|
|
| 244 |
|
|
| 245 |
|
@return |
| 246 |
|
@throws |
| 247 |
|
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 248 |
0
|
public byte[] readRawByte() throws IOException {... |
| 249 |
0
|
byte[] bytes = new byte[2]; |
| 250 |
0
|
bytes[0] = (byte) Type.BYTE.code; |
| 251 |
0
|
in.readFully(bytes, 1, 1); |
| 252 |
0
|
return bytes; |
| 253 |
|
} |
| 254 |
|
|
| 255 |
|
|
| 256 |
|
|
| 257 |
|
|
| 258 |
|
@return |
| 259 |
|
@throws |
| 260 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 261 |
0
|
public boolean readBool() throws IOException {... |
| 262 |
0
|
return in.readBoolean(); |
| 263 |
|
} |
| 264 |
|
|
| 265 |
|
|
| 266 |
|
|
| 267 |
|
|
| 268 |
|
@return |
| 269 |
|
@throws |
| 270 |
|
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 271 |
0
|
public byte[] readRawBool() throws IOException {... |
| 272 |
0
|
byte[] bytes = new byte[2]; |
| 273 |
0
|
bytes[0] = (byte) Type.BOOL.code; |
| 274 |
0
|
in.readFully(bytes, 1, 1); |
| 275 |
0
|
return bytes; |
| 276 |
|
} |
| 277 |
|
|
| 278 |
|
|
| 279 |
|
|
| 280 |
|
|
| 281 |
|
@return |
| 282 |
|
@throws |
| 283 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 284 |
0
|
public int readInt() throws IOException {... |
| 285 |
0
|
return in.readInt(); |
| 286 |
|
} |
| 287 |
|
|
| 288 |
|
|
| 289 |
|
|
| 290 |
|
|
| 291 |
|
@return |
| 292 |
|
@throws |
| 293 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 294 |
1500
|
public short readShort() throws IOException {... |
| 295 |
1500
|
return in.readShort(); |
| 296 |
|
} |
| 297 |
|
|
| 298 |
|
|
| 299 |
|
|
| 300 |
|
|
| 301 |
|
@return |
| 302 |
|
@throws |
| 303 |
|
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 304 |
0
|
public byte[] readRawInt() throws IOException {... |
| 305 |
0
|
byte[] bytes = new byte[5]; |
| 306 |
0
|
bytes[0] = (byte) Type.INT.code; |
| 307 |
0
|
in.readFully(bytes, 1, 4); |
| 308 |
0
|
return bytes; |
| 309 |
|
} |
| 310 |
|
|
| 311 |
|
|
| 312 |
|
|
| 313 |
|
|
| 314 |
|
@return |
| 315 |
|
@throws |
| 316 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 317 |
0
|
public long readLong() throws IOException {... |
| 318 |
0
|
return in.readLong(); |
| 319 |
|
} |
| 320 |
|
|
| 321 |
|
|
| 322 |
|
|
| 323 |
|
|
| 324 |
|
@return |
| 325 |
|
@throws |
| 326 |
|
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 327 |
0
|
public byte[] readRawLong() throws IOException {... |
| 328 |
0
|
byte[] bytes = new byte[9]; |
| 329 |
0
|
bytes[0] = (byte) Type.LONG.code; |
| 330 |
0
|
in.readFully(bytes, 1, 8); |
| 331 |
0
|
return bytes; |
| 332 |
|
} |
| 333 |
|
|
| 334 |
|
|
| 335 |
|
|
| 336 |
|
|
| 337 |
|
@return |
| 338 |
|
@throws |
| 339 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 340 |
0
|
public float readFloat() throws IOException {... |
| 341 |
0
|
return in.readFloat(); |
| 342 |
|
} |
| 343 |
|
|
| 344 |
|
|
| 345 |
|
|
| 346 |
|
|
| 347 |
|
@return |
| 348 |
|
@throws |
| 349 |
|
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 350 |
0
|
public byte[] readRawFloat() throws IOException {... |
| 351 |
0
|
byte[] bytes = new byte[5]; |
| 352 |
0
|
bytes[0] = (byte) Type.FLOAT.code; |
| 353 |
0
|
in.readFully(bytes, 1, 4); |
| 354 |
0
|
return bytes; |
| 355 |
|
} |
| 356 |
|
|
| 357 |
|
|
| 358 |
|
|
| 359 |
|
|
| 360 |
|
@return |
| 361 |
|
@throws |
| 362 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 363 |
0
|
public double readDouble() throws IOException {... |
| 364 |
0
|
return in.readDouble(); |
| 365 |
|
} |
| 366 |
|
|
| 367 |
|
|
| 368 |
|
|
| 369 |
|
|
| 370 |
|
@return |
| 371 |
|
@throws |
| 372 |
|
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 373 |
0
|
public byte[] readRawDouble() throws IOException {... |
| 374 |
0
|
byte[] bytes = new byte[9]; |
| 375 |
0
|
bytes[0] = (byte) Type.DOUBLE.code; |
| 376 |
0
|
in.readFully(bytes, 1, 8); |
| 377 |
0
|
return bytes; |
| 378 |
|
} |
| 379 |
|
|
| 380 |
|
|
| 381 |
|
|
| 382 |
|
|
| 383 |
|
@return |
| 384 |
|
@throws |
| 385 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 386 |
6752
|
public String readString() throws IOException {... |
| 387 |
6752
|
return WritableUtils.readString(in); |
| 388 |
|
} |
| 389 |
|
|
| 390 |
|
|
| 391 |
|
|
| 392 |
|
|
| 393 |
|
@return |
| 394 |
|
@throws |
| 395 |
|
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
|
| 396 |
0
|
public byte[] readRawString() throws IOException {... |
| 397 |
0
|
int length = in.readInt(); |
| 398 |
0
|
byte[] bytes = new byte[5 + length]; |
| 399 |
0
|
bytes[0] = (byte) Type.STRING.code; |
| 400 |
0
|
bytes[1] = (byte) (0xff & (length >> 24)); |
| 401 |
0
|
bytes[2] = (byte) (0xff & (length >> 16)); |
| 402 |
0
|
bytes[3] = (byte) (0xff & (length >> 8)); |
| 403 |
0
|
bytes[4] = (byte) (0xff & length); |
| 404 |
0
|
in.readFully(bytes, 5, length); |
| 405 |
0
|
return bytes; |
| 406 |
|
} |
| 407 |
|
|
| 408 |
|
|
| 409 |
|
|
| 410 |
|
|
| 411 |
|
@return |
| 412 |
|
@throws |
| 413 |
|
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 414 |
0
|
@SuppressWarnings("unchecked")... |
| 415 |
|
public ArrayList readVector() throws IOException { |
| 416 |
0
|
int length = readVectorHeader(); |
| 417 |
0
|
ArrayList result = new ArrayList(length); |
| 418 |
0
|
for (int i = 0; i < length; i++) { |
| 419 |
0
|
result.add(read()); |
| 420 |
|
} |
| 421 |
0
|
return result; |
| 422 |
|
} |
| 423 |
|
|
| 424 |
|
|
| 425 |
|
|
| 426 |
|
|
| 427 |
|
@return |
| 428 |
|
@throws |
| 429 |
|
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 430 |
0
|
public byte[] readRawVector() throws IOException {... |
| 431 |
0
|
Buffer buffer = new Buffer(); |
| 432 |
0
|
int length = readVectorHeader(); |
| 433 |
0
|
buffer.append(new byte[] {(byte) Type.VECTOR.code, |
| 434 |
|
(byte) (0xff & (length >> 24)), (byte) (0xff & (length >> 16)), |
| 435 |
|
(byte) (0xff & (length >> 8)), (byte) (0xff & length)}); |
| 436 |
0
|
for (int i = 0; i < length; i++) { |
| 437 |
0
|
buffer.append(readRaw()); |
| 438 |
|
} |
| 439 |
0
|
return buffer.get(); |
| 440 |
|
} |
| 441 |
|
|
| 442 |
|
|
| 443 |
|
|
| 444 |
|
|
| 445 |
|
@return |
| 446 |
|
@throws |
| 447 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 448 |
0
|
public int readVectorHeader() throws IOException {... |
| 449 |
0
|
return in.readInt(); |
| 450 |
|
} |
| 451 |
|
|
| 452 |
|
|
| 453 |
|
|
| 454 |
|
|
| 455 |
|
@return |
| 456 |
|
@throws |
| 457 |
|
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 458 |
0
|
@SuppressWarnings("unchecked")... |
| 459 |
|
public List readList() throws IOException { |
| 460 |
0
|
List list = new ArrayList(); |
| 461 |
0
|
Object obj = read(); |
| 462 |
0
|
while (obj != null) { |
| 463 |
0
|
list.add(obj); |
| 464 |
0
|
obj = read(); |
| 465 |
|
} |
| 466 |
0
|
return list; |
| 467 |
|
} |
| 468 |
|
|
| 469 |
|
|
| 470 |
|
|
| 471 |
|
|
| 472 |
|
@return |
| 473 |
|
@throws |
| 474 |
|
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
| 475 |
0
|
public byte[] readRawList() throws IOException {... |
| 476 |
0
|
Buffer buffer = new Buffer(new byte[] {(byte) Type.LIST.code}); |
| 477 |
0
|
byte[] bytes = readRaw(); |
| 478 |
0
|
while (bytes != null) { |
| 479 |
0
|
buffer.append(bytes); |
| 480 |
0
|
bytes = readRaw(); |
| 481 |
|
} |
| 482 |
0
|
buffer.append(new byte[] {(byte) Type.MARKER.code}); |
| 483 |
0
|
return buffer.get(); |
| 484 |
|
} |
| 485 |
|
|
| 486 |
|
|
| 487 |
|
|
| 488 |
|
|
| 489 |
|
@return |
| 490 |
|
@throws |
| 491 |
|
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
| 492 |
0
|
@SuppressWarnings("unchecked")... |
| 493 |
|
public TreeMap readMap() throws IOException { |
| 494 |
0
|
int length = readMapHeader(); |
| 495 |
0
|
TreeMap result = new TreeMap(); |
| 496 |
0
|
for (int i = 0; i < length; i++) { |
| 497 |
0
|
Object key = read(); |
| 498 |
0
|
Object value = read(); |
| 499 |
0
|
result.put(key, value); |
| 500 |
|
} |
| 501 |
0
|
return result; |
| 502 |
|
} |
| 503 |
|
|
| 504 |
|
|
| 505 |
|
|
| 506 |
|
|
| 507 |
|
@return |
| 508 |
|
@throws |
| 509 |
|
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
| 510 |
0
|
public byte[] readRawMap() throws IOException {... |
| 511 |
0
|
Buffer buffer = new Buffer(); |
| 512 |
0
|
int length = readMapHeader(); |
| 513 |
0
|
buffer.append(new byte[] {(byte) Type.MAP.code, |
| 514 |
|
(byte) (0xff & (length >> 24)), (byte) (0xff & (length >> 16)), |
| 515 |
|
(byte) (0xff & (length >> 8)), (byte) (0xff & length)}); |
| 516 |
0
|
for (int i = 0; i < length; i++) { |
| 517 |
0
|
buffer.append(readRaw()); |
| 518 |
0
|
buffer.append(readRaw()); |
| 519 |
|
} |
| 520 |
0
|
return buffer.get(); |
| 521 |
|
} |
| 522 |
|
|
| 523 |
|
|
| 524 |
|
|
| 525 |
|
|
| 526 |
|
@return |
| 527 |
|
@throws |
| 528 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 529 |
0
|
public int readMapHeader() throws IOException {... |
| 530 |
0
|
return in.readInt(); |
| 531 |
|
} |
| 532 |
|
|
| 533 |
|
} |