@Test public void testGetContentFromURL() throws Exception { String encoding = "utf8"; String contentClassPath = "/eu/dnetlib/iis/wf/importer/content/sample_data.txt"; URL url = ObjectStoreContentProviderUtils.class.getResource(contentClassPath); String expectedResult = ClassPathResourceProvider.getResourceContent(contentClassPath); byte[] result = ObjectStoreContentProviderUtils.getContentFromURL(url, new ContentRetrievalContext(1, 1, null)); assertNotNull(result); assertEquals(expectedResult, IOUtils.toString(result, encoding)); }
public static byte[] getContentFromURL(String resourceLoc, ContentRetrievalContext context) throws IOException, InvalidSizeException, S3EndpointNotFoundException { if (resourceLoc.startsWith(S3_URL_PREFIX)) { return getContentFromS3(resourceLoc, context); } else { return getContentFromURL(new URL(resourceLoc), context); } }
ObjectStoreContentProviderUtils { public static byte[] getContentFromURL(String resourceLoc, ContentRetrievalContext context) throws IOException, InvalidSizeException, S3EndpointNotFoundException { if (resourceLoc.startsWith(S3_URL_PREFIX)) { return getContentFromS3(resourceLoc, context); } else { return getContentFromURL(new URL(resourceLoc), context); } } }
ObjectStoreContentProviderUtils { public static byte[] getContentFromURL(String resourceLoc, ContentRetrievalContext context) throws IOException, InvalidSizeException, S3EndpointNotFoundException { if (resourceLoc.startsWith(S3_URL_PREFIX)) { return getContentFromS3(resourceLoc, context); } else { return getContentFromURL(new URL(resourceLoc), context); } } private  ObjectStoreContentProviderUtils(); }
ObjectStoreContentProviderUtils { public static byte[] getContentFromURL(String resourceLoc, ContentRetrievalContext context) throws IOException, InvalidSizeException, S3EndpointNotFoundException { if (resourceLoc.startsWith(S3_URL_PREFIX)) { return getContentFromS3(resourceLoc, context); } else { return getContentFromURL(new URL(resourceLoc), context); } } private  ObjectStoreContentProviderUtils(); static byte[] getContentFromURL(String resourceLoc,
			ContentRetrievalContext context); static byte[] getContentFromURL(URL url,
            ContentRetrievalContext context); static String generateObjectId(String resultId, String url,
			String defaultEncoding, String digestAlgorithm); static String extractResultIdFromObjectId(String objectId); }
ObjectStoreContentProviderUtils { public static byte[] getContentFromURL(String resourceLoc, ContentRetrievalContext context) throws IOException, InvalidSizeException, S3EndpointNotFoundException { if (resourceLoc.startsWith(S3_URL_PREFIX)) { return getContentFromS3(resourceLoc, context); } else { return getContentFromURL(new URL(resourceLoc), context); } } private  ObjectStoreContentProviderUtils(); static byte[] getContentFromURL(String resourceLoc,
			ContentRetrievalContext context); static byte[] getContentFromURL(URL url,
            ContentRetrievalContext context); static String generateObjectId(String resultId, String url,
			String defaultEncoding, String digestAlgorithm); static String extractResultIdFromObjectId(String objectId); static final String defaultEncoding; }