Changeset 1679 for trunk/docx4j/src/main


Ignore:
Timestamp:
10/07/11 00:09:49 (8 months ago)
Author:
jharrop
Message:

createImagePart from FilePath? - y.rolland's patch of Thu Oct 06, 2011. Interim commit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/docx4j/src/main/java/org/docx4j/openpackaging/parts/WordprocessingML/BinaryPartAbstractImage.java

    r1559 r1679  
    1818 
    1919 */ 
    20  
    2120package org.docx4j.openpackaging.parts.WordprocessingML; 
    2221 
     
    6766import org.docx4j.wml.SectPr.PgSz; 
    6867 
    69  
    7068public abstract class BinaryPartAbstractImage extends BinaryPart { 
    7169         
    7270        protected static Logger log = Logger.getLogger(BinaryPartAbstractImage.class); 
    73          
    7471        final static String IMAGE_DIR_PREFIX = "/word/media/"; 
    7572        final static String IMAGE_NAME_PREFIX = "image"; 
     
    9087                super(externalTarget); 
    9188        } 
    92          
    93          
    9489        ImageInfo imageInfo; 
    9590 
    9691        public ImageInfo getImageInfo() { 
    9792                 
    98                 if (imageInfo==null) { 
    99                          
     93        if (imageInfo == null) { 
    10094                        // TODO - create it 
    101                          
    10295                        // Save byte buffer as a tmp file 
    103                          
    10496                        // Generate ImageInfo 
    105                          
    10697                        // Delete tmp file 
    107                          
    10898                } 
    10999                 
     
    114104                this.imageInfo = imageInfo; 
    115105        } 
    116          
    117106        // TODO, instead of Part.getOwningRelationshipPart(), 
    118107        // it would be better to have getOwningRelationship(), 
     
    120109        // This is a temp workaround     
    121110        Relationship rel; 
    122                  
    123111        static int density = 150;        
     112 
    124113        /** 
    125114         * Set the resolution at which a PDF or EPS is converted 
     
    139128                 
    140129        } 
    141  
    142130        static ImageManager imageManager; 
    143131 
     
    160148        } 
    161149         
     150    /* 
     151     * Possibility to put directly an image filePath instead of giving an image byte array 
     152     * @param wordMLPackage 
     153     * @param filePath 
     154     *  
     155     */ 
     156    public static BinaryPartAbstractImage createImagePart(WordprocessingMLPackage wordMLPackage, 
     157            String filePath) throws Exception { 
     158 
     159        return createImagePartFromFilePath(wordMLPackage, 
     160                wordMLPackage.getMainDocumentPart(), filePath); 
     161 
     162    } 
     163 
    162164        /** 
    163165         * This method assumes your package is a docx (not a pptx or xlsx). 
     
    169171         */ 
    170172        @Deprecated 
    171         public static String createImageName(Base sourcePart, String proposedRelId, String ext ) { 
     173    public static String createImageName(Base sourcePart, String proposedRelId, String ext) { 
    172174                 
    173175                return PartName.generateUniqueName(sourcePart, proposedRelId,  
     
    175177        } 
    176178 
    177         public static String createImageName(OpcPackage opcPackage, Base sourcePart, String proposedRelId, String ext ) { 
     179    public static String createImageName(OpcPackage opcPackage, Base sourcePart, String proposedRelId, String ext) { 
    178180                 
    179181                if (opcPackage instanceof WordprocessingMLPackage) {             
     
    193195        } 
    194196         
    195          
    196          
    197197        /** 
    198198         * Create an image part from the provided byte array, attach it to the source part 
     
    222222                fos.write(bytes); 
    223223                fos.close(); 
    224                 log.debug("created tmp file: " +  tmpImageFile.getAbsolutePath() ); 
     224        log.debug("created tmp file: " + tmpImageFile.getAbsolutePath()); 
    225225                                 
    226226                ImageInfo info = ensureFormatIsSupported(tmpImageFile.getAbsolutePath(), tmpImageFile, bytes); 
     
    232232                 
    233233                // Ensure the relationships part exists 
    234                 if (sourcePart.getRelationshipsPart()==null)  
     234        if (sourcePart.getRelationshipsPart() == null) { 
    235235                        RelationshipsPart.createRelationshipsPartForPart(sourcePart); 
     236        } 
    236237 
    237238                String proposedRelId = sourcePart.getRelationshipsPart().getNextId(); 
    238239                                 
    239                 String ext = info.getMimeType().substring( info.getMimeType().indexOf("/")+1); 
     240        String ext = info.getMimeType().substring(info.getMimeType().indexOf("/") + 1); 
    240241                 
    241242//              System.out.println(ext); 
    242243                 
    243244                BinaryPartAbstractImage imagePart =  
    244                         (BinaryPartAbstractImage)ctm.newPartForContentType( 
     245                (BinaryPartAbstractImage) ctm.newPartForContentType( 
    245246                                info.getMimeType(),  
    246                                 createImageName(opcPackage, sourcePart, proposedRelId, ext), null 
    247                                  ); 
    248                                  
    249                 log.debug("created part " + imagePart.getClass().getName() + 
    250                                 " with name " + imagePart.getPartName().toString() );            
     247                createImageName(opcPackage, sourcePart, proposedRelId, ext), null); 
     248                                 
     249        log.debug("created part " + imagePart.getClass().getName() 
     250                + " with name " + imagePart.getPartName().toString()); 
    251251                 
    252252                FileInputStream fis = new FileInputStream(tmpImageFile);                 
    253                 imagePart.setBinaryData( fis ); 
    254                                  
    255                 imagePart.rel = sourcePart.addTargetPart(imagePart, proposedRelId); 
     253        imagePart.setBinaryData(fis); 
     254                                 
     255        imagePart.rel = sourcePart.addTargetPart(imagePart, proposedRelId); 
    256256                 
    257257                imagePart.setImageInfo(info); 
     
    264264                fis = null; 
    265265                System.gc();             
    266                 if (tmpImageFile.delete() ) { 
    267                         log.debug(".. deleted " +  tmpImageFile.getAbsolutePath() );                     
     266        if (tmpImageFile.delete()) { 
     267            log.debug(".. deleted " + tmpImageFile.getAbsolutePath()); 
    268268                } else { 
    269269                        log.warn("Couldn't delete tmp file " + tmpImageFile.getAbsolutePath()); 
     
    277277        } 
    278278 
    279         /** 
     279    /* 
     280     * Default, we suppose that image is load in a Byte Array (using function createImagePart) so isLoad is true. 
     281     * If we use createImagePartFromFilePath, then isLoad is false 
     282     */ 
     283    static boolean isLoad = true; 
     284 
     285        /** 
     286     * Create an image part from the provided filePath image, attach it to the source part 
     287     * (eg the main document part, a header part etc), and return it. 
     288     *  
     289     * Works for both docx and pptx. 
     290     *  
     291     * @param opcPackage 
     292     * @param sourcePart 
     293     * @param filePath 
     294     * @return 
     295     * @throws Exception 
     296     */ 
     297    public static BinaryPartAbstractImage createImagePartFromFilePath( 
     298            OpcPackage opcPackage, 
     299            Part sourcePart, String filePath) throws Exception { 
     300 
     301        final File locFile = new File(filePath); 
     302        final byte[] locByte = new byte[1]; 
     303        //We are in the case that image is not load (no byte Array) so isLoad is false 
     304        isLoad = false; 
     305        //Here, filePath doesn't represent the tmpFile but the path of the image to load 
     306        ImageInfo info = ensureFormatIsSupported(filePath, locFile, locByte); 
     307 
     308        ContentTypeManager ctm = opcPackage.getContentTypeManager(); 
     309 
     310        // Ensure the relationships part exists 
     311        if (sourcePart.getRelationshipsPart() == null) { 
     312            RelationshipsPart.createRelationshipsPartForPart(sourcePart); 
     313        } 
     314 
     315        String proposedRelId = sourcePart.getRelationshipsPart().getNextId(); 
     316 
     317        String ext = info.getMimeType().substring(info.getMimeType().indexOf("/") + 1); 
     318 
     319        BinaryPartAbstractImage imagePart = 
     320                (BinaryPartAbstractImage) ctm.newPartForContentType( 
     321                info.getMimeType(), 
     322                createImageName(opcPackage, sourcePart, proposedRelId, ext), null); 
     323 
     324        log.debug("created part " + imagePart.getClass().getName() 
     325                + " with name " + imagePart.getPartName().toString()); 
     326 
     327        FileInputStream fis = new FileInputStream(locFile); 
     328        imagePart.setBinaryData(fis); 
     329 
     330        imagePart.rel = sourcePart.addTargetPart(imagePart, proposedRelId); 
     331 
     332        imagePart.setImageInfo(info); 
     333 
     334        return imagePart; 
     335 
     336    } 
     337 
     338    /** 
    280339         * @param bytes 
    281340         * @param imageFile 
     
    306365                                // (To use an image natively, we do need a preloader) 
    307366                                imagePreloaderFound = false; 
    308                                 log.warn(e.getMessage() ); 
     367                log.warn(e.getMessage()); 
    309368                        } 
    310369                         
    311                         if ( imagePreloaderFound && 
    312                                         (info.getMimeType().equals(ContentTypes.IMAGE_TIFF) 
     370            if (imagePreloaderFound 
     371                    && (info.getMimeType().equals(ContentTypes.IMAGE_TIFF) 
    313372                                        || info.getMimeType().equals(ContentTypes.IMAGE_EMF2) // ImageInfo  
    314373                                        || info.getMimeType().equals(ContentTypes.IMAGE_WMF)  
     
    317376                                        || info.getMimeType().equals(ContentTypes.IMAGE_GIF)  
    318377//                                       || info.getMimeType().equals(ContentTypes.IMAGE_EPS) 
    319                                         || info.getMimeType().equals(ContentTypes.IMAGE_BMP)  
    320                                         )) { 
     378                    || info.getMimeType().equals(ContentTypes.IMAGE_BMP))) { 
    321379                                        // TODO: add other supported formats 
    322380                                 
     
    325383                                log.debug(".. supported natively by Word");                                      
    326384                                 
    327                         } else if ( imageFile!=null && bytes!=null ) { 
     385            } else if (imageFile != null && bytes != null) { 
    328386                                 
    329387                                // otherwise (eg if its an EPS or PDF), try to convert it 
     
    337395                                log.debug(".. attempting to convert to PNG");            
    338396                                 
    339                                 ByteArrayInputStream bais = new ByteArrayInputStream(bytes);                     
    340                                 fos = new FileOutputStream(imageFile);  
    341                                                          
    342                                 convertToPNG(bais, fos, density); 
     397                //If image haven't been load (using function createImagePartFromFilePath), we load it 
     398                if (isLoad == false) { 
     399 
     400                    // So first, we create tmpFile       
     401                    File tmpImageFile = File.createTempFile("img", ".img"); 
     402                    fos = new FileOutputStream(tmpImageFile); 
     403 
     404                    //Now we get the inputStream, which is represented by imageFile in this case 
     405                    FileInputStream bais = new FileInputStream(imageFile); 
     406 
     407                    //We convert 
     408                    convertToPNG(bais, fos, density); 
     409 
     410                    //We don't forget to change locFile because the new image file is the converted image file!! 
     411                    imageFile = tmpImageFile; 
     412                     
     413                } //Else image has been load in an array (using function cretaImagePart) 
     414                else { 
     415                                        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);                     
     416                                        fos = new FileOutputStream(imageFile);  
     417                                        convertToPNG(bais, fos, density); 
     418                } 
     419 
    343420                                fos.close(); 
    344421                                fos = null; 
     
    346423                                // We need to refresh image info  
    347424                                imageManager.getCache().clearCache(); 
    348                                 info = getImageInfo(imageFile.getAbsolutePath() ); 
     425                info = getImageInfo(imageFile.getAbsolutePath()); 
    349426                                 
    350427                                // Debug ... 
     
    359436        } 
    360437         
    361  
    362438        /** 
    363439         * Create a linked image part, and attach it as a rel of the docx main document part 
     
    387463                        Part sourcePart, String fileurl) throws Exception { 
    388464                 
    389                 ImageInfo info = ensureFormatIsSupported(fileurl, null,null); 
     465        ImageInfo info = ensureFormatIsSupported(fileurl, null, null); 
    390466 
    391467                ContentTypeManager ctm = opcPackage.getContentTypeManager(); 
     
    393469                // In order to ensure unique part name, 
    394470                // idea is to use the relId, which ought to be unique 
    395                 String ext = info.getMimeType().substring( info.getMimeType().indexOf("/")+1); 
     471        String ext = info.getMimeType().substring(info.getMimeType().indexOf("/") + 1); 
    396472                 
    397473                BinaryPartAbstractImage imagePart =  
    398                         (BinaryPartAbstractImage)ctm.newPartForContentType( 
     474                (BinaryPartAbstractImage) ctm.newPartForContentType( 
    399475                                info.getMimeType(),  
    400                                 createImageName(opcPackage, sourcePart, proposedRelId, ext ), null ); 
     476                createImageName(opcPackage, sourcePart, proposedRelId, ext), null); 
    401477                                 
    402478                log.debug("created part " + imagePart.getClass().getName() 
     
    419495        }        
    420496 
    421          
    422497        /** 
    423498         * Create a <wp:inline> element suitable for this image, 
     
    439514                        int id1, int id2) throws Exception { 
    440515                 
    441                 return createImageInline( filenameHint,  altText,  
    442                                  id1, id2, false); 
     516        return createImageInline(filenameHint, altText, 
     517                id1, id2, false); 
    443518 
    444519        } 
     
    462537                        int id1, int id2, boolean link) throws Exception { 
    463538                                 
    464                 WordprocessingMLPackage wmlPackage = ((WordprocessingMLPackage)this.getPackage()); 
     539        WordprocessingMLPackage wmlPackage = ((WordprocessingMLPackage) this.getPackage()); 
    465540                 
    466541                List<SectionWrapper> sections = wmlPackage.getDocumentModel().getSections(); 
    467                 PageDimensions page = sections.get(sections.size()-1).getPageDimensions(); 
     542        PageDimensions page = sections.get(sections.size() - 1).getPageDimensions(); 
    468543                 
    469544                CxCy cxcy = CxCy.scale(imageInfo, page); 
    470545  
    471                 return createImageInline( filenameHint,  altText,  
    472                                  id1,  id2,  cxcy.getCx(),  cxcy.getCy(), link );                
    473         } 
    474          
     546        return createImageInline(filenameHint, altText, 
     547                id1, id2, cxcy.getCx(), cxcy.getCy(), link); 
     548        } 
    475549         
    476550        /** 
     
    492566                        int id1, int id2, long cx) throws Exception { 
    493567                 
    494                 return createImageInline( filenameHint,  altText,  
    495                                  id1, id2, cx, false); 
     568        return createImageInline(filenameHint, altText, 
     569                id1, id2, cx, false); 
    496570 
    497571        } 
     
    559633                        int id1, int id2, long cx, long cy, boolean link) throws Exception { 
    560634                 
    561                 if (filenameHint==null) { 
     635        if (filenameHint == null) { 
    562636                        filenameHint = ""; 
    563637                } 
    564                 if (altText==null) { 
     638        if (altText == null) { 
    565639                        altText = ""; 
    566640                } 
     
    576650//              "<w:p ><w:r>" + 
    577651//        "<w:drawing>" + 
    578         "<wp:inline distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"" + namespaces + ">" + 
    579         "<wp:extent cx=\"${cx}\" cy=\"${cy}\"/>" + 
    580         "<wp:effectExtent l=\"0\" t=\"0\" r=\"0\" b=\"0\"/>" + //l=\"19050\" 
    581         "<wp:docPr id=\"${id1}\" name=\"${filenameHint}\" descr=\"${altText}\"/><wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" noChangeAspect=\"1\"/></wp:cNvGraphicFramePr><a:graphic xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\">" + 
    582         "<a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/picture\">" + 
    583         "<pic:pic xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\"><pic:nvPicPr><pic:cNvPr id=\"${id2}\" name=\"${filenameHint}\"/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill>" + 
    584         "<a:blip " + type +"=\"${rEmbedId}\"/><a:stretch><a:fillRect/></a:stretch></pic:blipFill>" + 
    585         "<pic:spPr><a:xfrm><a:off x=\"0\" y=\"0\"/><a:ext cx=\"${cx}\" cy=\"${cy}\"/></a:xfrm><a:prstGeom prst=\"rect\"><a:avLst/></a:prstGeom></pic:spPr></pic:pic></a:graphicData></a:graphic>" + 
    586         "</wp:inline>"; // + 
     652                "<wp:inline distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"" + namespaces + ">" 
     653                + "<wp:extent cx=\"${cx}\" cy=\"${cy}\"/>" 
     654                + "<wp:effectExtent l=\"0\" t=\"0\" r=\"0\" b=\"0\"/>" + //l=\"19050\" 
     655                "<wp:docPr id=\"${id1}\" name=\"${filenameHint}\" descr=\"${altText}\"/><wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" noChangeAspect=\"1\"/></wp:cNvGraphicFramePr><a:graphic xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\">" 
     656                + "<a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/picture\">" 
     657                + "<pic:pic xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\"><pic:nvPicPr><pic:cNvPr id=\"${id2}\" name=\"${filenameHint}\"/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill>" 
     658                + "<a:blip " + type + "=\"${rEmbedId}\"/><a:stretch><a:fillRect/></a:stretch></pic:blipFill>" 
     659                + "<pic:spPr><a:xfrm><a:off x=\"0\" y=\"0\"/><a:ext cx=\"${cx}\" cy=\"${cy}\"/></a:xfrm><a:prstGeom prst=\"rect\"><a:avLst/></a:prstGeom></pic:spPr></pic:pic></a:graphicData></a:graphic>" 
     660                + "</wp:inline>"; // + 
    587661//        "</w:drawing>" + 
    588662//        "</w:r></w:p>"; 
    589         java.util.HashMap<String, String>mappings = new java.util.HashMap<String, String>(); 
     663        java.util.HashMap<String, String> mappings = new java.util.HashMap<String, String>(); 
    590664         
    591665        mappings.put("cx", Long.toString(cx)); 
     
    593667        mappings.put("filenameHint", filenameHint); 
    594668        mappings.put("altText", altText); 
    595         mappings.put("rEmbedId", rel.getId()  ); 
     669        mappings.put("rEmbedId", rel.getId()); 
    596670        mappings.put("id1", Integer.toString(id1)); 
    597671        mappings.put("id2", Integer.toString(id2)); 
    598672 
    599         Object o = org.docx4j.XmlUtils.unmarshallFromTemplate(ml, mappings ) ;         
    600         Inline inline = (Inline)((JAXBElement)o).getValue(); 
     673        Object o = org.docx4j.XmlUtils.unmarshallFromTemplate(ml, mappings); 
     674        Inline inline = (Inline) ((JAXBElement) o).getValue(); 
    601675         
    602676                return inline;           
    603677        } 
    604          
    605         final static String namespaces = " xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" " + 
    606                         "xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" " + 
    607                         "xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\""; 
    608          
     678    final static String namespaces = " xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" " 
     679            + "xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" " 
     680            + "xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\""; 
    609681         
    610682        public static ImageInfo getImageInfo(String uri) throws Exception { 
     
    662734        } 
    663735         
    664          
    665         public static void displayImageInfo(ImageInfo info ) { 
    666                  
     736    public static void displayImageInfo(ImageInfo info) { 
     737         
    667738                  ImageSize size = info.getSize(); 
    668739                   
     
    671742 
    672743                  log.debug(info.getOriginalURI() + " " + info.getMimeType()  
    673                                   + " " + Math.round(dPx.getWidth()) +"x" + Math.round(dPx.getHeight())); 
     744                + " " + Math.round(dPx.getWidth()) + "x" + Math.round(dPx.getHeight())); 
    674745                                   
    675                   log.debug("Resolution:" + Math.round(size.getDpiHorizontal()) + "x" + Math.round(size.getDpiVertical()) ); 
    676                   log.debug("Print size: " + Math.round(dPt.getWidth()/72) + "\" x" + Math.round(dPt.getHeight()/72)+"\"" );  
     746        log.debug("Resolution:" + Math.round(size.getDpiHorizontal()) + "x" + Math.round(size.getDpiVertical())); 
     747        log.debug("Print size: " + Math.round(dPt.getWidth() / 72) + "\" x" + Math.round(dPt.getHeight() / 72) + "\""); 
    677748                 
    678749        } 
     
    720791                                return bytes; 
    721792                        } else {                                 
    722                                 log.error("Part was a " + part.getClass().getName() ); 
     793                log.error("Part was a " + part.getClass().getName()); 
    723794                        } 
    724795                } else { 
     
    732803                 
    733804                long cx; 
     805 
    734806                /** 
    735807                 * @return the resulting cx 
     
    738810                        return cx; 
    739811                } 
    740  
    741812                long cy; 
     813 
    742814                /** 
    743815                 * @return the resulting cy 
     
    747819                } 
    748820                boolean scaled; 
     821 
    749822                /** 
    750823                 * @return whether it was necessary to scale 
     
    777850                        long cy; 
    778851                        boolean scaled = false; 
    779                         if (imageWidthTwips>writableWidthTwips) { 
     852            if (imageWidthTwips > writableWidthTwips) { 
    780853                                 
    781854                                log.debug("Scaling image to fit page width"); 
     
    783856                                 
    784857                                cx = UnitsOfMeasurement.twipToEMU(writableWidthTwips); 
    785                                 cy = UnitsOfMeasurement.twipToEMU(dPt.getHeight() * 20 * writableWidthTwips/imageWidthTwips); 
     858                cy = UnitsOfMeasurement.twipToEMU(dPt.getHeight() * 20 * writableWidthTwips / imageWidthTwips); 
    786859                                 
    787860                        } else { 
     
    800873                         
    801874                } 
    802                  
    803875        } 
    804876 
     
    814886         * @throws InterruptedException 
    815887         */ 
    816         public static void convertToPNG(InputStream is, OutputStream os, int density) throws IOException, InterruptedException{ 
     888    public static void convertToPNG(InputStream is, OutputStream os, int density) throws IOException, InterruptedException { 
    817889                 
    818890        /* 
     
    863935         } 
    864936          
    865          if (p.waitFor()!=0) { 
     937        if (p.waitFor() != 0) { 
    866938          log.error("Error"); 
    867939         } 
     
    873945            while (true) { 
    874946             int bytesRead = is.read(buffer); 
    875              if ( bytesRead == -1 ) break; 
     947            if (bytesRead == -1) { 
     948                break; 
     949            } 
    876950             os.write(buffer, 0, bytesRead); 
    877951            } 
     
    880954        }//class 
    881955 
    882  
    883         class StreamGobbler extends Thread 
    884         { 
     956class StreamGobbler extends Thread { 
    885957                // The term "StreamGobbler" was taken from an article called "When Runtime.exec() won't",  
    886958                // see http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html. 
     
    889961          OutputStream os; 
    890962 
    891  
    892           StreamGobbler(InputStream is, OutputStream redirect) 
    893           { 
    894               this.is =  new BufferedInputStream(is); 
     963    StreamGobbler(InputStream is, OutputStream redirect) { 
     964        this.is = new BufferedInputStream(is); 
    895965              this.os = redirect; 
    896966          } 
    897967 
    898           public void run() 
    899           { 
    900               try 
    901               {   
     968    public void run() { 
     969        try { 
    902970                  BinaryPartAbstractImage.copy2(is, os); 
    903               } catch (IOException ioe) 
    904                   { 
     971        } catch (IOException ioe) { 
    905972                  ioe.printStackTrace(); 
    906973                  } 
    907974          } 
    908            
    909         } 
    910                  
     975        } 
Note: See TracChangeset for help on using the changeset viewer.