Examples of HelperFile


Examples of com.kentcdodds.javahelper.model.HelperFile

   * @param location
   * @throws FileNotFoundException
   * @throws IOException
   */
  public static void saveBytesToFile(byte[] bytes, String location) throws FileNotFoundException, IOException {
    HelperFile helperFile = new HelperFile(bytes, location);
    helperFile.saveBytes();
  }
View Full Code Here

Examples of com.kentcdodds.javahelper.model.HelperFile

   * @throws FileNotFoundException when trying to get the file
   * @throws IOException when trying to read the file
   * @throws Exception when trying to read a file too big for a byte[]
   */
  public static byte[] getFileBytes(File file) throws FileNotFoundException, IOException, Exception {
    HelperFile helperFile = new HelperFile(file);
    return helperFile.getBytes();
  }
View Full Code Here

Examples of com.kentcdodds.javahelper.model.HelperFile

      byte[] buffer = new byte[1024];
      int length;
      while ((length = zipIn.read(buffer)) != -1) {
        byteOut.write(buffer, 0, length);
      }
      helperFiles.add(new HelperFile(byteOut.toByteArray(), nextEntry.getName()));
      byteOut.close();
    }
    return helperFiles;
  }
View Full Code Here

Examples of com.kentcdodds.javahelper.model.HelperFile

      EmailAttachment emailAttachment = attachments[i];
      byte[] fileBytes = emailAttachment.getFileBytes();
      if (fileBytes == null) {
        fileBytes = IOHelper.getFileBytes(emailAttachment.getFile()); //in the case that this is a file on disk
      }
      files[i] = new HelperFile(fileBytes, emailAttachment.getAttachmentName());
    }
    byte[] zippedBytes = IOHelper.zipFiles(files);
    return new EmailAttachment(zippedBytes, "attachments.zip", "application/zip", Message.ATTACHMENT);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.