Changeset 1093
- Timestamp:
- 02/27/10 17:44:08 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/docx4j/src/main/java/org/docx4j/openpackaging/io/LoadFromZipNG.java
r1078 r1093 33 33 import java.net.URI; 34 34 import java.net.URISyntaxException; 35 import java.nio.ByteBuffer; 35 36 import java.util.Enumeration; 36 37 import java.util.HashMap; … … 61 62 62 63 63 64 64 /** 65 65 * Create a Package object from a Zip file or input stream. … … 171 171 } catch (Exception e) { 172 172 log.error(e.getMessage()); 173 throw new Docx4JException("Error processing zip file (is it a zip file?)", e); 173 174 } 174 175 175 176 // At this point, we're finished with the zip input stream 176 177 // TODO, so many of the below methods could be renamed. … … 289 290 String partName) 290 291 //private static InputStream getInputStreamFromZippedPart(ZipFile zf, String partName) 291 throws IOException {292 throws IOException, NullPointerException { 292 293 293 294 InputStream in = null; 294 295 //in = zf.getInputStream( zf.getEntry(partName ) ); 295 in = partByteArrays.get(partName).getInputStream(); 296 try { 297 in = partByteArrays.get(partName).getInputStream(); 298 } catch (NullPointerException npe) { 299 log.warn("Part " + partName + " was null"); 300 throw npe; 301 } 296 302 return in; 297 303 } … … 554 560 // Try to get it as a binary part 555 561 part = getBinaryPart(partByteArrays, ctm, resolvedPartUri); 562 log.warn("Using BinaryPart for " + resolvedPartUri); 563 556 564 ((BinaryPart)part).setBinaryData(is); 557 565 } … … 609 617 public static class ByteArray implements Serializable { 610 618 619 private static final long serialVersionUID = -784146312250361899L; 620 // 4469266984448028582L; 621 611 622 private byte[] bytes; 623 public byte[] getBytes() { 624 return bytes; 625 } 626 627 private String mimetype; 628 public String getMimetype() { 629 return mimetype; 630 } 612 631 613 632 public ByteArray(byte[] bytes) { … … 616 635 } 617 636 637 638 public ByteArray(ByteBuffer bb, String mimetype ) { 639 640 bb.clear(); 641 bytes = new byte[bb.capacity()]; 642 bb.get(bytes, 0, bytes.length); 643 644 this.mimetype = mimetype; 645 } 646 647 618 648 public InputStream getInputStream() { 619 620 649 return new ByteArrayInputStream(bytes); 621 650 } 651 652 public int getLength() { 653 return bytes.length; 622 654 } 623 655
Note: See TracChangeset
for help on using the changeset viewer.
