Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Add:
- org.apache.commons.vfs2.util.FileObjectUtils.readProperties(FileObject)
- org.apache.commons.vfs2.util.FileObjectUtils.readProperties(FileObject, Properties)
As:
/** * Reads the given file into a new {@link Properties}. * * @param fileObject the file to read * @return a new {@link Properties}. * @throws IOException * @throws FileSystemException On error getting this file's content. * @throws IOException On error getting this file's content. * @since 2.4 */ public static Properties readProperties(final FileObject fileObject) throws FileSystemException, IOException { return readProperties(fileObject, new Properties()); } /** * Reads the given file into a new given {@link Properties}. * * @param fileObject the file to read * @param properties the destination * @return a new {@link Properties}. * @throws FileSystemException On error getting this file's content. * @throws IOException On error getting this file's content. * @since 2.4 */ public static Properties readProperties(final FileObject fileObject, final Properties properties) throws FileSystemException, IOException { if (fileObject == null) { return properties; } try (InputStream inputStream = fileObject.getContent().getInputStream()) { properties.load(inputStream); } return properties; }