1 17 package org.alfresco.repo.content.transform; 18 19 import java.util.Map ; 20 21 import org.alfresco.service.cmr.repository.ContentReader; 22 import org.alfresco.service.cmr.repository.ContentWriter; 23 import org.apache.commons.logging.Log; 24 import org.apache.commons.logging.LogFactory; 25 26 37 public class BinaryPassThroughContentTransformer extends AbstractContentTransformer 38 { 39 private static final Log logger = LogFactory.getLog(BinaryPassThroughContentTransformer.class); 40 41 44 public double getReliability(String sourceMimetype, String targetMimetype) 45 { 46 if (sourceMimetype.startsWith(StringExtractingContentTransformer.PREFIX_TEXT)) 47 { 48 return 0.0; 50 } 51 else if (!sourceMimetype.equals(targetMimetype)) 52 { 53 return 0.0; 55 } 56 else 57 { 58 return 1.0; 60 } 61 } 62 63 66 public void transformInternal( 67 ContentReader reader, 68 ContentWriter writer, 69 Map <String , Object > options) throws Exception 70 { 71 writer.putContent(reader.getContentInputStream()); 73 } 74 } 75 | Popular Tags |