Skip to content

Access Java resources as .properties, File, XML or String

Notifications You must be signed in to change notification settings

ONSdigital/resource-utils

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Resource Utils

What is it?

Resource Utils provides straightforward access to Java resources in several formats so you don't have to write boilerplate conversions.

To get a resource as Properties:

Properties properties = ResourceUtils.getProperties("/com/github/davidcarboni/app.properties");

To get a resource as an XML Document:

Document document = ResourceUtils.getXml("/com/github/davidcarboni/app.xml");

To get a resource as a String:

String string = ResourceUtils.getString("/com/github/davidcarboni/string.resource");

To extract a resource to a temp File:

File temp = ResourceUtils.getFile("/com/github/davidcarboni/file.resource");

To get a resource as a Reader:

Reader reader = ResourceUtils.getReader("/com/github/davidcarboni/character.resource");

To get a resource as a good old InputStream:

InputStream input = ResourceUtils.getStream("/com/github/davidcarboni/resource.data");

Maven usage

To use resource-utils in your project:

	<dependency>
		<groupId>com.github.davidcarboni</groupId>
		<artifactId>resource-utils</artifactId>
		<version>1.1.0</version>
	</dependency>

About

Access Java resources as .properties, File, XML or String

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 96.4%
  • Makefile 1.8%
  • Shell 1.8%