Ejemplo n.º 1
0
 static void writeEntryToStream(FolderEntry folderEntry, OutputStream outputStream)
     throws IOException {
   // use java Properties to save the files
   Properties properties = new Properties();
   properties.setProperty(CONTENT_TYPE, folderEntry.getContentType().toString());
   properties.setProperty(CONTENT_ID, folderEntry.getContentId());
   properties.setProperty(FOLDER_ID, folderEntry.getFolderId());
   properties.store(outputStream, "saved");
 }
Ejemplo n.º 2
0
 static boolean matches(Path pathFile, String contentId, FolderContentType contentType) {
   boolean passFilter = false;
   try (InputStream inputStream = Files.newInputStream(pathFile)) {
     FolderEntry folderEntry = readEntryFromStream(inputStream);
     if (Objects.equals(contentType, folderEntry.getContentType())
         && //
         StringUtils.equalsIgnoreCase(folderEntry.getContentId(), contentId)) {
       passFilter = true;
     }
   } catch (IOException e) {
     throw new TDPException(UNABLE_TO_READ_FOLDER_ENTRY, e, build().put("path", pathFile));
   }
   return passFilter;
 }