< prev index next >

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

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2012, 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 --- 1,7 ---- /* ! * 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
*** 31,41 **** import javax.activation.*; import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.MimeUtility; import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ContentType; /** ! * JAF data content handler for text/plain --> String * */ public class StringDataContentHandler implements DataContentHandler { private static ActivationDataFlavor myDF = new ActivationDataFlavor( java.lang.String.class, --- 31,41 ---- import javax.activation.*; import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.MimeUtility; import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ContentType; /** ! * JAF data content handler for text/plain --&gt; String * */ public class StringDataContentHandler implements DataContentHandler { private static ActivationDataFlavor myDF = new ActivationDataFlavor( java.lang.String.class,
*** 49,58 **** --- 49,59 ---- /** * Return the DataFlavors for this <code>DataContentHandler</code>. * * @return The DataFlavors */ + @Override public DataFlavor[] getTransferDataFlavors() { return new DataFlavor[] { getDF() }; } /**
*** 60,79 **** --- 61,82 ---- * * @param df The DataFlavor * @param ds The DataSource corresponding to the data * @return String object */ + @Override public Object getTransferData(DataFlavor df, DataSource ds) throws IOException { // use myDF.equals to be sure to get ActivationDataFlavor.equals, // which properly ignores Content-Type parameters in comparison if (getDF().equals(df)) return getContent(ds); else return null; } + @Override public Object getContent(DataSource ds) throws IOException { String enc = null; InputStreamReader is = null; try {
*** 118,127 **** --- 121,131 ---- } /** * Write the object to the output stream, using the specified MIME type. */ + @Override public void writeTo(Object obj, String type, OutputStream os) throws IOException { if (!(obj instanceof String)) throw new IOException("\"" + getDF().getMimeType() + "\" DataContentHandler requires String object, " +
< prev index next >