public static byte[] createChecksum(String location, String algorithm) { InputStream in = null; try { in = LocationUtils.getInputStream(location); return createChecksum(in, algorithm); } catch (IOException e) { throw new IllegalStateException("Unexpected IO error", e); } finally { IOUtils.closeQuietly(in); } }
/** * Get the contents of <code>location</code> as a <code>String</code> using the specified character encoding. */ public static final String toString(String location, String encoding) { InputStream in = null; try { in = getInputStream(location); if (encoding == null) { return IOUtils.toString(in); } else { return IOUtils.toString(in, encoding); } } catch (IOException e) { throw new IllegalStateException("Unexpected IO error", e); } finally { IOUtils.closeQuietly(in); } }
public static final void copyLocationToFile(String location, File destination) { Assert.notNull(location); Assert.notNull(destination); logger.debug("Copying [{}]->[{}]", location, destination); InputStream in = null; try { in = getInputStream(location); FileUtils.copyInputStreamToFile(in, destination); } catch (IOException e) { throw new IllegalStateException(e); } finally { IOUtils.closeQuietly(in); } }
public static <T> T getObject(String location, Class<T> type) { InputStream in = null; try { in = LocationUtils.getInputStream(location); return getObject(in, type); } catch (IOException e) { throw new IllegalStateException("Unexpected JAXB error", e); } finally { IOUtils.closeQuietly(in); } } }
/** * Return a <code>BufferedReader</code> for the location indicated using the encoding indicated. */ public static final BufferedReader getBufferedReader(String location, String encoding) throws IOException { try { InputStream in = getInputStream(location); return getBufferedReader(in, encoding); } catch (IOException e) { throw new IOException("Unexpected IO error", e); } }
protected void configureFromXmlLocation(String location) { InputStream in = null; try { in = LocationUtils.getInputStream(location); Document document = getDocument(in); configure(document); } catch (Exception e) { throw new IllegalStateException(e); } finally { IOUtils.closeQuietly(in); } }
protected void configureFromXmlLocation(String location) { InputStream in = null; try { in = LocationUtils.getInputStream(location); Document document = getDocument(in); configure(document); } catch (Exception e) { throw new IllegalStateException(e); } finally { IOUtils.closeQuietly(in); } }
protected static Config getConfig(String location) { InputStream in = null; try { in = LocationUtils.getInputStream(location); return getConfig(in); } catch (IOException e) { throw illegalState(e, "unexpected io error -> [%s]", location); } finally { IOUtils.closeQuietly(in); } }
@Override public <T> T getObject(String location, Class<T> type) { Assert.noBlanks(location); Assert.noNulls(type); InputStream in = null; try { in = LocationUtils.getInputStream(location); return getObject(in, type); } catch (IOException e) { throw new IllegalStateException("Unexpected IO error", e); } finally { IOUtils.closeQuietly(in); } }
@Override public CopyResult scp(String location, RemoteFile destination) { Assert.notNull(location); Assert.isTrue(LocationUtils.exists(location), location + " does not exist"); InputStream in = null; try { in = LocationUtils.getInputStream(location); return scp(in, destination); } catch (Exception e) { throw new IllegalStateException(e); } finally { IOUtils.closeQuietly(in); } }
@Override public void copyLocationToFile(String location, RemoteFile destination) { Assert.notNull(location); Assert.isTrue(LocationUtils.exists(location), location + " does not exist"); InputStream in = null; try { in = LocationUtils.getInputStream(location); copyInputStreamToFile(in, destination); } catch (Exception e) { throw new IllegalStateException(e); } finally { IOUtils.closeQuietly(in); } }
@Override public void copyLocationToFile(String location, RemoteFile destination) { Assert.notNull(location); Assert.isTrue(LocationUtils.exists(location), location + " does not exist"); InputStream in = null; try { in = LocationUtils.getInputStream(location); copyInputStreamToFile(in, destination); } catch (Exception e) { throw new IllegalStateException(e); } finally { IOUtils.closeQuietly(in); } }
properties = loadRiceProperties(location); } else if (xml) { in = LocationUtils.getInputStream(location); if (!silent) { logger.info("Loading XML properties - [{}]", location);