public static void doUploadFiles( WriteContext context, File folder, boolean unzip, List<File> uploadedFiles) throws IOException, GitAPIException { if (uploadedFiles != null) { for (File uploadedFile : uploadedFiles) { String name = uploadedFile.getName(); if (unzip && name.endsWith(".zip")) { // lets unzip zip files into a folder File unzipDir = uploadedFile.getParentFile(); ZipInputStream zis = new ZipInputStream(new FileInputStream(uploadedFile)); try { ZipEntry entry = zis.getNextEntry(); if (!entry.isDirectory()) { String folderName = name.substring(0, name.length() - 4); unzipDir = new File(uploadedFile.getParentFile(), folderName); } } finally { closeQuietly(zis); } Zips.unzip(new FileInputStream(uploadedFile), unzipDir); uploadedFile.delete(); uploadedFile = unzipDir; } LOG.info("Adding to folder: " + folder + " file: " + uploadedFile + " to git"); context.addFile(uploadedFile); } } }
public void write(WriteContext context, Object obj) { if (Deploy.debug) { Debug.writeBegin(context, Const4.YAPSHORT); } int shortValue = ((Short) obj).shortValue(); context.writeBytes(new byte[] {(byte) (shortValue >> 8), (byte) shortValue}); if (Deploy.debug) { Debug.writeEnd(context); } }
public void write(WriteContext context, Object obj) { if (Deploy.debug) { Debug4.writeBegin(context, Const4.YAPBYTE); } context.writeByte(((Byte) obj).byteValue()); if (Deploy.debug) { Debug4.writeEnd(context); } }