@Override protected void sendData(OutputStream out) throws IOException { // Get the content from the content URL and write it to out InputStream is = contentService.getRawReader(data.getContentUrl()).getContentInputStream(); try { byte[] tmp = new byte[4096]; int len; while ((len = is.read(tmp)) >= 0) { out.write(tmp, 0, len); } } finally { // we're done with the input stream, close it is.close(); } } }
@Override protected void sendData(OutputStream out) throws IOException { // Get the content from the content URL and write it to out InputStream is = contentService.getRawReader(data.getContentUrl()).getContentInputStream(); try { byte[] tmp = new byte[4096]; int len; while ((len = is.read(tmp)) >= 0) { out.write(tmp, 0, len); } } finally { // we're done with the input stream, close it is.close(); } } }
@Override protected long lengthOfData() throws IOException { return contentService.getRawReader(data.getContentUrl()).getSize(); }
@Override protected long lengthOfData() throws IOException { return contentService.getRawReader(data.getContentUrl()).getSize(); }
if (tagSummary == null) ContentReader contentReader = contentService.getRawReader(contentUrl); if (contentReader != null && contentReader.exists())
if (tagSummary == null) ContentReader contentReader = contentService.getRawReader(contentUrl); if (contentReader != null && contentReader.exists())
private void checkForExistence(Set<String> urls, boolean mustExist) { for (String url : urls) { ContentReader rawReader = contentService.getRawReader(url); if (mustExist && !rawReader.exists()) { fail("Content URL should have existed but did not: " + url); } else if (!mustExist && rawReader.exists()) { fail("Content URL should not have existed but did: " + url); } } }
public void testGetRawReader() throws Exception { ContentReader reader = contentService.getRawReader("test://non-existence"); assertNotNull("A reader is expected with content URL referencing no content", reader); assertFalse("Reader should not have any content", reader.exists()); // Now write something ContentWriter writer = contentService.getWriter(contentNodeRef, ContentModel.PROP_CONTENT, false); writer.putContent("ABC from " + getName()); // Try again String contentUrl = writer.getContentUrl(); reader = contentService.getRawReader(contentUrl); assertNotNull("Expected reader for live, raw content", reader); assertEquals("Content sizes don't match", writer.getSize(), reader.getSize()); }
ContentReader reader = contentService.getRawReader(contentData.getContentUrl()); assertNotNull(reader); assertTrue("Content was cleaned before end of transaction", reader.exists()); properties).getChildRef(); reader = contentService.getRawReader(contentData.getContentUrl()); assertNotNull(reader); assertTrue("Content was cleaned before end of transaction", reader.exists());
ContentData contentData = transactionService.getRetryingTransactionHelper().doInTransaction(testCallback); ContentReader reader = contentService.getRawReader(contentData.getContentUrl()); assertNotNull(reader); assertTrue("Content should not have been eagerly deleted.", reader.exists()); cleaner.execute(); reader = contentService.getRawReader(contentData.getContentUrl());
ContentData contentData = transactionService.getRetryingTransactionHelper().doInTransaction(testCallback); ContentReader reader = contentService.getRawReader(contentData.getContentUrl()); assertNotNull(reader); assertTrue("Content was cleaned despite being re-referenced in the transaction", reader.exists());