< prev index next >
jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/JpegDataContentHandler.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1997, 2013, 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
@@ -45,13 +45,14 @@
extends Component
implements DataContentHandler {
public static final String STR_SRC = "java.awt.Image";
/**
- * return the DataFlavors for this <code>DataContentHandler</code>
+ * Return the DataFlavors for this <code>DataContentHandler</code>
* @return The DataFlavors.
*/
+ @Override
public DataFlavor[] getTransferDataFlavors() { // throws Exception;
DataFlavor flavors[] = new DataFlavor[1];
try {
flavors[0] =
@@ -65,15 +66,16 @@
return flavors;
}
/**
- * return the Transfer Data of type DataFlavor from InputStream
- * @param df The DataFlavor.
- * @param ins The InputStream corresponding to the data.
+ * Return the Transfer Data of type DataFlavor from InputStream
+ * @param df The DataFlavor
+ * @param ds The DataSource
* @return The constructed Object.
*/
+ @Override
public Object getTransferData(DataFlavor df, DataSource ds) {
// this is sort of hacky, but will work for the
// sake of testing...
if (df.getMimeType().startsWith("image/jpeg")) {
@@ -96,10 +98,11 @@
}
/**
*
*/
+ @Override
public Object getContent(DataSource ds) { // throws Exception;
InputStream inputStream = null;
BufferedImage jpegLoadImage = null;
try {
@@ -107,18 +110,22 @@
jpegLoadImage = ImageIO.read(inputStream);
} catch (Exception e) {
}
- return (Image) jpegLoadImage;
+ return jpegLoadImage;
}
/**
- * construct an object from a byte stream
+ * Construct an object from a byte stream
* (similar semantically to previous method, we are deciding
* which one to support)
+ * @param obj object to write
+ * @param mimeType requested MIME type of the resulting byte stream
+ * @param os OutputStream
*/
+ @Override
public void writeTo(Object obj, String mimeType, OutputStream os)
throws IOException {
if (!mimeType.equals("image/jpeg"))
throw new IOException(
"Invalid content type \""
< prev index next >