Load the content of the zip entry, and return it as a byte array.

@return the entry as a byte[] array
@throws IOException
If an I/O exception occurs.
@throws InterruptedException
If the thread was interrupted.
171891
public byte[] load() throws IOException, InterruptedException {
        try (InputStream is = open()) {
            return FileUtils.readAllBytesAsArray(is, uncompressedSize);
        }
    }
371090
protected InputStream readFiles() throws IOException {
    BufferedInputStream input = new BufferedInputStream(openFile(), BUFFER_SIZE);
    input.mark(100);
    try {
      return new XZInputStream(input);
    } catch (IOException e) {
      input.reset();
    }
    try {
      return new CompressorStreamFactory().createCompressorInputStream(input);
    } catch (CompressorException e) {
      input.reset();
    }
    try {
      return new ArchiveStreamFactory().createArchiveInputStream(input);
    } catch (ArchiveException e) {
      input.reset();
    }
    return input;
  }
940639
@Override
    public byte[] asBytes() throws IOException {
        try (ServletInputStream stream = request.getInputStream()) {
            ByteArrayOutputStream array = new ByteArrayOutputStream(stream.available());
            return array.toByteArray();
        }
    }
119550
public byte[] getJarBytes() throws EeClassLoaderException {
        DataInputStream dataInputStream = null;
        byte[] bytes;

        try {
            long jarEntrySize = jarEntry.getSize();
            if (jarEntrySize <= 0  ||  jarEntrySize >= Integer.MAX_VALUE) {
                throw new EeClassLoaderException("Invalid size " + jarEntrySize + " for entry " + jarEntry);
            }

            bytes = new byte[(int) jarEntrySize];

            InputStream inputStream = jarFileInfo.getJarFile().getInputStream(jarEntry);
            dataInputStream = new DataInputStream(inputStream);
            dataInputStream.readFully(bytes);
        } catch (IOException e) {
            throw new EeClassLoaderException(null, e);
        } finally {
            if (dataInputStream != null) {
                try {
                    dataInputStream.close();
                } catch (IOException e) {
                    // Ignore
                }
            }
        }

        return bytes;
    }
1133449
@Override
  public ZKData<byte[]> getZKByteData(String path) throws InterruptedException, KeeperException
  {
    return getZKByteData(path, null);
  }
1137563
public ByteBuffer readAll() throws IOException {
    ByteBuffer bb = ByteBuffer.allocate((int) length);
    if (positionalReadMode) {
      read(0, bb.array(), 0, (int) length);
      return bb;
    } else {
      read(bb.array(), 0, (int) length);
      return bb;
    }
  }
200900
public byte[] readRemainingBytes() throws IOException {
    if (this.available() > 0) {
      byte[] b = new byte[this.available()];
      if (read(b) >= 0) {
        return b;
      } else {
        throw new IOException("returned negative number of remaining bytes");
      }
    } else {
      throw new IOException("no more bytes");
    }
  }
841958
private byte[] getBytes(ZipEntry ze) throws IOException {
        try (InputStream is = super.getInputStream(ze)) {
            return IOUtils.readFully(is, (int)ze.getSize(), true);
        }
    }
688602
private ZipEntry readLOC() throws IOException {
        try {
            readFully(tmpbuf, 0, LOCHDR);
        } catch (EOFException e) {
            return null;
        }
        if (get32(tmpbuf, 0) != LOCSIG) {
            return null;
        }
        // get flag first, we need check EFS.
        flag = get16(tmpbuf, LOCFLG);
        // get the entry name and create the ZipEntry first
        int len = get16(tmpbuf, LOCNAM);
        int blen = b.length;
        if (len > blen) {
            do
                blen = blen * 2;
            while (len > blen);
            b = new byte[blen];
        }
        readFully(b, 0, len);
        // Force to use UTF-8 if the EFS bit is ON, even the cs is NOT UTF-8
        ZipEntry e = createZipEntry(((flag & EFS) != 0)
                                    ? zc.toStringUTF8(b, len)
                                    : zc.toString(b, len));
        // now get the remaining fields for the entry
        if ((flag & 1) == 1) {
            throw new ZipException("encrypted ZIP entry not supported");
        }
        e.method = get16(tmpbuf, LOCHOW);
        e.time = get32(tmpbuf, LOCTIM);
        if ((flag & 8) == 8) {
            /* "Data Descriptor" present */
            if (e.method != DEFLATED) {
                throw new ZipException(
                        "only DEFLATED entries can have EXT descriptor");
            }
        } else {
            e.crc = get32(tmpbuf, LOCCRC);
            e.csize = get32(tmpbuf, LOCSIZ);
            e.size = get32(tmpbuf, LOCLEN);
        }
        len = get16(tmpbuf, LOCEXT);
        if (len > 0) {
            byte[] bb = new byte[len];
            readFully(bb, 0, len);
            e.setExtra(bb);
            // extra fields are in "HeaderID(2)DataSize(2)Data... format
            if (e.csize == ZIP64_MAGICVAL || e.size == ZIP64_MAGICVAL) {
                int off = 0;
                while (off + 4 < len) {
                    int sz = get16(bb, off + 2);
                    if (get16(bb, off) == ZIP64_EXTID) {
                        off += 4;
                        // LOC extra zip64 entry MUST include BOTH original and
                        // compressed file size fields
                        if (sz < 16 || (off + sz) > len ) {
                            // Invalid zip64 extra fields, simply skip. Even it's
                            // rare, it's possible the entry size happens to be
                            // the magic value and it "accidnetly" has some bytes
                            // in extra match the id.
                            return e;
                        }
                        e.size = get64(bb, off);
                        e.csize = get64(bb, off + 8);
                        break;
                    }
                    off += (sz + 4);
                }
            }
        }
        return e;
    }
1306706
public synchronized byte[] readBytes() throws IOException
    {
        final int dataLength = dataInputStream.readInt();
        final byte[] data = new byte[dataLength];

        final int dataRead = dataInputStream.read(data, 0, dataLength);
        if (dataRead != dataLength) throw new IOException("Not enough data available");

        return data;
    }
750475
public byte[] asByteArray() {
        Objects.requireNonNull(data);
        byte[] ret = Arrays.copyOf(data, data.length);
        Arrays.fill(data, (byte) 0);
        data = null;
        return ret;
    }
1303716
protected void loadEntries(final StorageAwareResource resource, final ZipInputStream zipIn) throws IOException {
    zipIn.getNextEntry();
    BufferedInputStream _bufferedInputStream = new BufferedInputStream(zipIn);
    this.readContents(resource, _bufferedInputStream);
    zipIn.getNextEntry();
    BufferedInputStream _bufferedInputStream_1 = new BufferedInputStream(zipIn);
    this.readResourceDescription(resource, _bufferedInputStream_1);
    if (this.storeNodeModel) {
      zipIn.getNextEntry();
      BufferedInputStream _bufferedInputStream_2 = new BufferedInputStream(zipIn);
      this.readNodeModel(resource, _bufferedInputStream_2);
    }
  }
531725
public byte[] getStreamAsBytearray() throws IOException {
		byte[] result = null;
		try {
			result = IOUtils.toByteArray(getStream());
		}
		catch (NullPointerException npex) {
			throw new IOException("Timeout has been forced by CommonHttpClient", npex);
		}
		return result;
	}
1201373
long getLong(final long off) throws IOException, InterruptedException {
        if (off < 0 || off > zipFileSlice.len - 8) {
            throw new IndexOutOfBoundsException();
        }
        if (read(off, scratch, 0, 8) < 8) {
            throw new EOFException("Unexpected EOF");
        }
        return ((scratch[7] & 0xffL) << 56) //
                | ((scratch[6] & 0xffL) << 48) //
                | ((scratch[5] & 0xffL) << 40) //
                | ((scratch[4] & 0xffL) << 32) //
                | ((scratch[3] & 0xffL) << 24) //
                | ((scratch[2] & 0xffL) << 16) //
                | ((scratch[1] & 0xffL) << 8) //
                | (scratch[0] & 0xffL);
    }
1053832
public byte[] readBytes() throws IORuntimeException {
		long len = file.length();
		if (len >= Integer.MAX_VALUE) {
			throw new IORuntimeException("File is larger then max array size");
		}

		byte[] bytes = new byte[(int) len];
		FileInputStream in = null;
		int readLength;
		try {
			in = new FileInputStream(file);
			readLength = in.read(bytes);
			if(readLength < len){
				throw new IOException(StrUtil.format("File length is [{}] but read [{}]!", len, readLength));
			}
		} catch (Exception e) {
			throw new IORuntimeException(e);
		} finally {
			IoUtil.close(in);
		}

		return bytes;
	}
1330589
public byte[] toByteArray() {
    try {
      final byte[] result = new byte[getSerializedSize()];
      final CodedOutputStream output = CodedOutputStream.newInstance(result);
      writeTo(output);
      output.checkNoSpaceLeft();
      return result;
    } catch (final IOException e) {
      throw new RuntimeException(
        "Serializing to a byte array threw an IOException " +
        "(should never happen).", e);
    }
  }
840272
public static ZipEntry getClassZipEntryFromZipInClassPath(String className) throws IOException {
		String fileName = StringSupport.replaceAll(className, ".", "/");
		fileName += ".class";

		Collection<String> jars = StringSupport.split(System.getProperty("java.class.path"), ";:", false);
		for(String jarFileName : jars) {
			if (jarFileName.endsWith(".jar") || jarFileName.endsWith(".zip")) {
				ZipEntry entry = getZipEntryFromZip(fileName, jarFileName);
				if (entry != null) {
					return entry;
				}
			}
		}
		return null;
	}