List of usage examples for org.apache.commons.io IOUtils toInputStream
public static InputStream toInputStream(String input, String encoding) throws IOException
From source file:ingest.inspect.GeoJsonInspector.java
/** * Gets the Input Stream for a GeoJSON Resource * /* ww w. ja v a 2s . co m*/ * @param dataResource * data resource to pull input stream from * @return File object */ private InputStream getGeoJsonInputStream(DataResource dataResource) throws IOException, AmazonClientException, InvalidInputException { FileAccessFactory fileFactory = ingestUtilities.getFileFactoryForDataResource(dataResource); InputStream inputStream; if (((GeoJsonDataType) dataResource.getDataType()).getLocation() != null) { inputStream = fileFactory.getFile(((GeoJsonDataType) dataResource.getDataType()).getLocation()); } else { String geoJsonContent = ((GeoJsonDataType) dataResource.getDataType()).getGeoJsonContent(); inputStream = IOUtils.toInputStream(geoJsonContent, "UTF-8"); } return inputStream; }