< prev index next >

jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/AttachmentPartImpl.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -86,10 +86,11 @@
         for (com.sun.xml.internal.org.jvnet.mimepull.Header hd : hdrs) {
             headers.addHeader(hd.getName(), hd.getValue());
         }
     }
 
+    @Override
     public int getSize() throws SOAPException {
         if (mimePart != null) {
             try {
                 return mimePart.read().available();
             } catch (IOException e) {

@@ -122,19 +123,21 @@
             }
             return bout.size();
         }
     }
 
+    @Override
     public void clearContent() {
         if (mimePart != null) {
             mimePart.close();
             mimePart = null;
         }
         dataHandler = null;
         rawContent = null;
     }
 
+    @Override
     public Object getContent() throws SOAPException {
         try {
             if (mimePart != null) {
                 //return an inputstream
                 return mimePart.read();

@@ -151,10 +154,11 @@
             log.log(Level.SEVERE, "SAAJ0575.soap.attachment.getcontent.exception", ex);
             throw new SOAPExceptionImpl(ex.getLocalizedMessage());
         }
     }
 
+    @Override
     public void setContent(Object object, String contentType)
         throws IllegalArgumentException {
         if (mimePart != null) {
             mimePart.close();
             mimePart = null;

@@ -163,27 +167,32 @@
 
         setDataHandler(dh);
     }
 
 
+    @Override
     public DataHandler getDataHandler() throws SOAPException {
         if (mimePart != null) {
             //return an inputstream
             return new DataHandler(new DataSource() {
 
+                @Override
                 public InputStream getInputStream() throws IOException {
                     return mimePart.read();
                 }
 
+                @Override
                 public OutputStream getOutputStream() throws IOException {
                     throw new UnsupportedOperationException("getOutputStream cannot be supported : You have enabled LazyAttachments Option");
                 }
 
+                @Override
                 public String getContentType() {
                     return mimePart.getContentType();
                 }
 
+                @Override
                 public String getName() {
                     return "MIMEPart Wrapper DataSource";
                 }
             });
         }

@@ -195,10 +204,11 @@
             throw new SOAPExceptionImpl("No data handler associated with this attachment");
         }
         return dataHandler;
     }
 
+    @Override
     public void setDataHandler(DataHandler dataHandler)
         throws IllegalArgumentException {
         if (mimePart != null) {
             mimePart.close();
             mimePart = null;

@@ -214,39 +224,47 @@
             log.log(Level.FINE, "SAAJ0580.soap.set.Content-Type",
                     new String[] { dataHandler.getContentType() });
         setMimeHeader("Content-Type", dataHandler.getContentType());
     }
 
+    @Override
     public void removeAllMimeHeaders() {
         headers.removeAllHeaders();
     }
 
+    @Override
     public void removeMimeHeader(String header) {
         headers.removeHeader(header);
     }
 
+    @Override
     public String[] getMimeHeader(String name) {
         return headers.getHeader(name);
     }
 
+    @Override
     public void setMimeHeader(String name, String value) {
         headers.setHeader(name, value);
     }
 
+    @Override
     public void addMimeHeader(String name, String value) {
         headers.addHeader(name, value);
     }
 
-    public Iterator getAllMimeHeaders() {
+    @Override
+    public Iterator<MimeHeader> getAllMimeHeaders() {
         return headers.getAllHeaders();
     }
 
-    public Iterator getMatchingMimeHeaders(String[] names) {
+    @Override
+    public Iterator<MimeHeader> getMatchingMimeHeaders(String[] names) {
         return headers.getMatchingHeaders(names);
     }
 
-    public Iterator getNonMatchingMimeHeaders(String[] names) {
+    @Override
+    public Iterator<MimeHeader> getNonMatchingMimeHeaders(String[] names) {
         return headers.getNonMatchingHeaders(names);
     }
 
     boolean hasAllHeaders(MimeHeaders hdrs) {
         if (hdrs != null) {

@@ -327,10 +345,11 @@
                 "Unable to copy MIME headers into attachment",
                 ex);
         }
     }
 
+    @Override
     public  void setBase64Content(InputStream content, String contentType)
         throws SOAPException {
 
         if (mimePart != null) {
             mimePart.close();

@@ -363,10 +382,11 @@
                 throw new SOAPException(ex);
             }
         }
     }
 
+    @Override
     public  InputStream getBase64Content() throws SOAPException {
         InputStream stream;
         if (mimePart != null) {
             stream = mimePart.read();
         } else if (rawContent != null) {

@@ -423,10 +443,11 @@
           log.log(Level.SEVERE,"SAAJ0572.soap.no.content.for.attachment");
           throw new SOAPExceptionImpl("No data handler/content associated with this attachment");
         }
     }
 
+    @Override
     public void setRawContent(InputStream content, String contentType)
         throws SOAPException {
         if (mimePart != null) {
             mimePart.close();
             mimePart = null;

@@ -473,10 +494,11 @@
             log.log(Level.SEVERE, "SAAJ0576.soap.attachment.setrawcontent.exception", e);
             throw new SOAPExceptionImpl(e.getLocalizedMessage());
         }
     } */
 
+    @Override
     public void setRawContentBytes(
         byte[] content, int off, int len, String contentType)
         throws SOAPException {
         if (mimePart != null) {
             mimePart.close();

@@ -496,10 +518,11 @@
                 "SAAJ0576.soap.attachment.setrawcontent.exception", e);
             throw new SOAPExceptionImpl(e.getLocalizedMessage());
         }
     }
 
+    @Override
     public  InputStream getRawContent() throws SOAPException {
         if (mimePart != null) {
             return mimePart.read();
         }
         if (rawContent != null) {

@@ -520,10 +543,11 @@
             log.severe("SAAJ0572.soap.no.content.for.attachment");
             throw new SOAPExceptionImpl("No data handler/content associated with this attachment");
         }
     }
 
+    @Override
     public  byte[] getRawContentBytes() throws SOAPException {
         InputStream ret;
         if (mimePart != null) {
             try {
                 ret = mimePart.read();

@@ -554,16 +578,18 @@
             throw new SOAPExceptionImpl("No data handler/content associated with this attachment");
         }
     }
 
     // attachments are equal if they are the same reference
+    @Override
     public boolean equals(Object o) {
         return (this == o);
     }
 
     // In JDK 8 we get a warning if we implement equals() but not hashCode().
     // There is no intuitive value for this, the default one in Object is fine.
+    @Override
     public int hashCode() {
         return super.hashCode();
     }
 
     public MimeHeaders getMimeHeaders() {
< prev index next >