Package ch.inftec.ju.util

Examples of ch.inftec.ju.util.IOUtil


      if (backupFile != null) {
        IOUtil.copyFile(sourceFile, backupFile, false);
      }
     
      String encryptedString = this.encryptToString();
      new IOUtil().writeTextToFile(encryptedString, sourceFile, true);
    }
View Full Code Here


         * @return Unmarshalled object
         * @throws ServiceDbException If the unmarshalling fails
         * @param <T> Type of expected object
         */
        public <T> T unmarshal(URL xmlUrl, Class<T> objClass) {
          String xmlString = new IOUtil().loadTextFromUrl(xmlUrl);
         
            @SuppressWarnings("unchecked")
            T object = (T)this.unmarshalRaw(xmlString, objClass);
           
            return object;
View Full Code Here

     * @param keyFile Path to resource containing the password
     * @return This builder
     */
    public EncryptorBuilder passwordByUrl(URL keyFile) {
      try {
        String password = new IOUtil().loadTextFromUrl(keyFile);
        AssertUtil.assertNotEmpty("Encryption password must not be empty", password);
       
        // We'll trim the password to avoid problems with new lines and the like
        return this.password(password.trim());
      } catch (Exception ex) {
View Full Code Here

     */
    public EncryptionBuilder propertyFile(URL propertyFile) throws JuException {
      AssertUtil.assertNull("Source has already been defined", this.encryptionTokens);
     
      this.sourceUrl = propertyFile;
      this.unencryptedString = new IOUtil().loadTextFromUrl(propertyFile);
     
      // Load tokens
     
      this.encryptionTokens = new ArrayList<>();
     
View Full Code Here

   
    public EncryptionBuilder csvFile(URL csvFile) throws JuException {
      AssertUtil.assertNull("Source has already been defined", this.encryptionTokens);
     
      this.sourceUrl = csvFile;
      this.unencryptedString = new IOUtil().loadTextFromUrl(csvFile);
     
      // Load tokens
     
      this.encryptionTokens = new ArrayList<>();
     
      try (Reader urlReader = new IOUtil().createReader(csvFile);
          CSVReader csvReader = new CSVReader(urlReader, DEFAULT_CSV_DELIMITER)) {
        List<String[]> allEntries = csvReader.readAll();
        for (String[] line : allEntries) {
          for (String cell : line) {
            // The CSVReader will return the actual String, but within the source CSV,
View Full Code Here

          if (JuUtils.getJuPropertyChain().get("ju-testing.export.compareToResource", Boolean.class, true)) {
            // Perform export in-memory and compare to resource
            String resourcePrefix = dataSetExport.resourcePrefix();
            String resourcePath = resourcePrefix + "/" + targetFileName;
            URL resourceUrl = JuUrl.singleResource(resourcePath);
            String resourceString = new IOUtil().loadTextFromUrl(resourceUrl);
           
            String xmlString = eb.writeToXmlString();
           
            logger.debug("Comparing DB export to resource {}", resourceUrl);
            Assert.assertEquals(resourceString, xmlString);
View Full Code Here

TOP

Related Classes of ch.inftec.ju.util.IOUtil

Copyright © 2018 www.massapicom. 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.