private static byte[] getFileAsBytes(String path) throws IOException {
   int len = 0;
   int totalLen = 0;
   Object streamOrError = FileManager.getInputStream(path, false, null, null);
   if (streamOrError instanceof String) {
     LogPanel.log((String) streamOrError);
     return null;
   }
   byte[] buf = new byte[1024];
   byte[] bytes = new byte[4096];
   BufferedInputStream bis = new BufferedInputStream((InputStream) streamOrError);
   while ((len = bis.read(buf)) > 0) {
     totalLen += len;
     if (totalLen >= bytes.length)
       bytes = ArrayUtil.ensureLength(bytes, totalLen * 2);
     System.arraycopy(buf, 0, bytes, totalLen - len, len);
   }
   bis.close();
   buf = new byte[totalLen];
   System.arraycopy(bytes, 0, buf, 0, totalLen);
   return buf;
 }