本文整理汇总了Java中org.alfresco.repo.content.filestore.FileContentWriter.putContent方法的典型用法代码示例。如果您正苦于以下问题:Java FileContentWriter.putContent方法的具体用法?Java FileContentWriter.putContent怎么用?Java FileContentWriter.putContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.repo.content.filestore.FileContentWriter
的用法示例。
在下文中一共展示了FileContentWriter.putContent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getWriter
import org.alfresco.repo.content.filestore.FileContentWriter; //导入方法依赖的package包/类
@Test
public void getWriter()
{
final String url = "store://some/url.bin";
FileContentWriter writer = (FileContentWriter) contentCache.getWriter(url);
writer.putContent("Some test content for " + getClass().getName());
assertEquals(url, writer.getContentUrl());
// Check cached item is recorded properly in cache
Mockito.verify(lookupTable).put(Key.forUrl(url), writer.getFile().getAbsolutePath());
Mockito.verify(lookupTable).put(Key.forCacheFile(writer.getFile().getAbsolutePath()), url);
}
示例2: afterPropertiesSet
import org.alfresco.repo.content.filestore.FileContentWriter; //导入方法依赖的package包/类
/**
* Checks for the JMagick and ImageMagick dependencies, using the common
* {@link #transformInternal(File, String , File, java.lang.String, TransformationOptions) transformation method} to check
* that the sample image can be converted.
* <p>
* If initialization is successful, then autoregistration takes place.
*/
public void afterPropertiesSet()
{
if (getMimetypeService() == null)
{
throw new AlfrescoRuntimeException("MimetypeMap not present");
}
try
{
// load, into memory the sample gif
String resourcePath = "org/alfresco/repo/content/transform/magick/alfresco.gif";
InputStream imageStream = getClass().getClassLoader().getResourceAsStream(resourcePath);
if (imageStream == null)
{
throw new AlfrescoRuntimeException("Sample image not found: " + resourcePath);
}
// dump to a temp file
File inputFile = TempFileProvider.createTempFile(
getClass().getSimpleName() + "_init_source_",
".gif");
FileContentWriter writer = new FileContentWriter(inputFile);
writer.putContent(imageStream);
// create the output file
File outputFile = TempFileProvider.createTempFile(
getClass().getSimpleName() + "_init_target_",
".png");
// execute it
transformInternal(
inputFile, MimetypeMap.MIMETYPE_IMAGE_GIF,
outputFile, MimetypeMap.MIMETYPE_IMAGE_PNG,
new TransformationOptions());
// check that the file exists
if (!outputFile.exists() || outputFile.length() == 0)
{
throw new Exception("Image conversion failed: \n" +
" from: " + inputFile + "\n" +
" to: " + outputFile);
}
// we can be sure that it works
setAvailable(true);
}
catch (Throwable e)
{
logger.error(
getClass().getSimpleName() + " not available: " +
(e.getMessage() != null ? e.getMessage() : ""));
// debug so that we can trace the issue if required
logger.debug(e);
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:60,代码来源:AbstractImageMagickContentTransformerWorker.java
示例3: saveDiskUsage
import org.alfresco.repo.content.filestore.FileContentWriter; //导入方法依赖的package包/类
private void saveDiskUsage()
{
File usageFile = new File(cache.getCacheRoot(), CACHE_USAGE_FILENAME);
FileContentWriter writer = new FileContentWriter(usageFile);
writer.putContent(currentUsageBytes.toString());
}