You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by th...@apache.org on 2005/06/22 05:53:39 UTC
svn commit: r191758 - in
/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments:
ByteArrayDataSource.java ImageDataSource.java ImageIO.java JDK13IO.java
MIMEHelper.java MimeBodyPartInputStream.java PartOnFile.java
Author: thilina
Date: Tue Jun 21 20:53:35 2005
New Revision: 191758
URL: http://svn.apache.org/viewcvs?rev=191758&view=rev
Log:
Cahges to Mime Helper & soem utility classes for attachements
Added:
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/ImageDataSource.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/ImageIO.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/JDK13IO.java
Modified:
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/ByteArrayDataSource.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/MIMEHelper.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/MimeBodyPartInputStream.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/PartOnFile.java
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/ByteArrayDataSource.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/ByteArrayDataSource.java?rev=191758&r1=191757&r2=191758&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/ByteArrayDataSource.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/ByteArrayDataSource.java Tue Jun 21 20:53:35 2005
@@ -24,47 +24,47 @@
import javax.activation.DataSource;
/**
- * @author Thilina Gunarathne thilina@opensource.lk
+ * @author <a href="mailto:thilina@opensource.lk">Thilina Gunarathne </a>
*/
public class ByteArrayDataSource implements DataSource {
- private byte[] data;
+ private byte[] data;
- private String type;
+ private String type;
- public ByteArrayDataSource(byte[] data, String type) {
- super();
- this.data = data;
- this.type = type;
- }
-
- public ByteArrayDataSource(byte[] data) {
- super();
- this.data = data;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getContentType() {
- if (type == null)
- return "application/octet-stream";
- else
- return type;
- }
-
- public InputStream getInputStream() throws IOException {
- return new ByteArrayInputStream(data);
- }
-
- public String getName() {
-
- return "ByteArrayDataSource";
- }
-
- public OutputStream getOutputStream() throws IOException {
- throw new IOException("Not Supported");
- }
+ public ByteArrayDataSource(byte[] data, String type) {
+ super();
+ this.data = data;
+ this.type = type;
+ }
+
+ public ByteArrayDataSource(byte[] data) {
+ super();
+ this.data = data;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getContentType() {
+ if (type == null)
+ return "application/octet-stream";
+ else
+ return type;
+ }
+
+ public InputStream getInputStream() throws IOException {
+ return new ByteArrayInputStream(data);
+ }
+
+ public String getName() {
+
+ return "ByteArrayDataSource";
+ }
+
+ public OutputStream getOutputStream() throws IOException {
+ throw new IOException("Not Supported");
+ }
}
Added: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/ImageDataSource.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/ImageDataSource.java?rev=191758&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/ImageDataSource.java (added)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/ImageDataSource.java Tue Jun 21 20:53:35 2005
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis.attachments;
+
+import java.awt.Image;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.activation.DataSource;
+
+public class ImageDataSource implements DataSource {
+
+ public static final String CONTENT_TYPE = "image/jpeg";
+
+ private final String name;
+
+ private final String contentType;
+
+ private byte[] data;
+
+ private ByteArrayOutputStream os;
+
+ public ImageDataSource(String name, Image data) {
+ this(name, CONTENT_TYPE, data);
+ } // ctor
+
+ public ImageDataSource(String name, String contentType, Image data) {
+ this.name = name;
+ this.contentType = contentType == null ? CONTENT_TYPE : contentType;
+ os = new ByteArrayOutputStream();
+ try {
+ if (data != null) {
+ new JDK13IO().saveImage(this.contentType, data, os);
+ }
+ } catch (Exception e) {
+ // log.error(Messages.getMessage("exception00"), e);
+ }
+ }
+
+ public String getName() {
+ return name;
+ } // getName
+
+ public String getContentType() {
+ return contentType;
+ } // getContentType
+
+ public InputStream getInputStream() throws IOException {
+ if (os.size() != 0) {
+ data = os.toByteArray();
+ os.reset();
+ }
+ return new ByteArrayInputStream(data == null ? new byte[0] : data);
+ } // getInputStream
+
+ public OutputStream getOutputStream() throws IOException {
+ if (os.size() != 0) {
+ data = os.toByteArray();
+ os.reset();
+ }
+ return os;
+ } // getOutputStream
+} // class ImageDataSource
Added: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/ImageIO.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/ImageIO.java?rev=191758&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/ImageIO.java (added)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/ImageIO.java Tue Jun 21 20:53:35 2005
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.attachments;
+import java.awt.*;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * This interface defines a ImageIO modules functionality
+ * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
+ * @since 2.0
+ */
+public interface ImageIO {
+ /**
+ * Save an image.
+ * @param id the mime-type of the format to save the image
+ * @param image the image to save
+ * @param os the output stream to write to
+ * @exception Exception if an error prevents image encoding
+ */
+
+ public void saveImage(String id, Image image, OutputStream os)
+ throws Exception;
+
+ /**
+ * Load an Image.
+ * @param in the stream to load the image
+ * @return the Image
+ */
+ public Image loadImage(InputStream in)
+ throws Exception;
+}
+
Added: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/JDK13IO.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/JDK13IO.java?rev=191758&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/JDK13IO.java (added)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/JDK13IO.java Tue Jun 21 20:53:35 2005
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.attachments;
+
+
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.MediaTracker;
+import java.awt.Toolkit;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import sun.awt.image.codec.JPEGImageEncoderImpl;
+
+/**
+ * JDK1.3 based Image I/O
+ *
+ * @author <a href="mailto:butek@us.ibm.com">Russell Butek</a>
+ */
+public class JDK13IO extends Component implements ImageIO {
+ /**
+ * Save an image.
+ * @param mimeType the mime-type of the format to save the image
+ * @param image the image to save
+ * @param os the stream to write to
+ * @exception Exception if an error prevents image encoding
+ */
+ public void saveImage(String mimeType, Image image, OutputStream os)
+ throws Exception {
+
+ BufferedImage rendImage = null;
+
+ // Create a BufferedImage
+ if (image instanceof BufferedImage) {
+ rendImage = (BufferedImage) image;
+ } else {
+ MediaTracker tracker = new MediaTracker(this);
+ tracker.addImage(image, 0);
+ tracker.waitForAll();
+ rendImage = new BufferedImage(image.getWidth(null), image.getHeight(null), 1);
+ Graphics g = rendImage.createGraphics();
+ g.drawImage(image, 0, 0, null);
+ }
+
+ // Write the image to the output stream
+ if ("image/jpeg".equals(mimeType)) {
+ JPEGImageEncoderImpl j = new JPEGImageEncoderImpl(os);
+ j.encode(rendImage);
+ }
+ else {
+ throw new IOException("Supports Jpeg Only");
+ }
+ } // saveImage
+
+ /**
+ * Load an Image.
+ * @param in the stream to load the image
+ * @return the Image
+ */
+ public Image loadImage(InputStream in) throws Exception {
+ if (in.available() <= 0) {
+ return null;
+ }
+ else {
+ byte[] bytes = new byte[in.available()];
+ org.apache.axis.attachments.IOUtils.readFully(in,bytes);
+ return Toolkit.getDefaultToolkit().createImage(bytes);
+ }
+ } // loadImage
+}
+
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/MIMEHelper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/MIMEHelper.java?rev=191758&r1=191757&r2=191758&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/MIMEHelper.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/MIMEHelper.java Tue Jun 21 20:53:35 2005
@@ -38,71 +38,72 @@
* if the Message is MTOM optimised then <code>MTOM_TYPE</code>
*/
public static final String MTOM_TYPE = "application/xop+xml";
-
+
/**
* If the message is Soap with Attachments <code>SwA_TYPE</code>
*/
public static final String SWA_TYPE = "text/xml";
-
+
/**
* <code>rootPart</code> is used as the key for the root BodyPart in the
* Parts HashMap
*/
public static final String ROOT_PART = "SoapPart";
-
+
/**
* <code>ContentType</code> of the MIME message
*/
ContentType contentType;
-
+
/**
* Mime <code>boundary</code> which seperates mime parts
*/
byte[] boundary;
-
+
/**
* <code>applicationType</code> used to distinguish between MTOM & SWA If
* the message is MTOM optimised type is application/xop+xml If the message
* is SWA, type is ??have to find out
*/
String applicationType = null;
-
+
/**
* <code>pushbackInStream</code> stores the reference to the incoming
* stream A PushbackStream has the ability to "push back" or "unread" one
* byte.
*/
PushbackInputStream pushbackInStream;
-
+
/**
* <code>mimeBodyPartsMap</code> stores the already parsed Mime Body
* Parts. This Map will be keyed using the content-ID's
*/
HashMap bodyPartsMap;
-
+
/**
* <code>partIndex</code>- Number of Mime parts parsed
*/
int partIndex = 0;
-
+
public MIMEHelper(InputStream inStream, String contentTypeString)
- throws OMException {
+ throws OMException {
+ bodyPartsMap = new HashMap();
try {
contentType = new ContentType(contentTypeString);
} catch (ParseException e) {
throw new OMException(
"Invalid Content Type Field in the Mime Message"
- + e.toString());
+ + e.toString());
}
// Boundary always have the prefix "--".
this.boundary = ("--" + contentType.getParameter("boundary"))
- .getBytes();
-
+ .getBytes();
+
//TODO do we need to wrap InputStream from a BufferedInputStream before
// wrapping from PushbackStream
pushbackInStream = new PushbackInputStream(inStream,
(this.boundary.length + 2));
-
+
// Move the read pointer to the begining of the first part
// read till the end of first boundary
while (true) {
@@ -116,20 +117,23 @@
value = pushbackInStream.read();
if (value == -1)
throw new OMException(
- "Unexpected End of Stream while searching for first Mime Boundary");
+ "Unexpected End of Stream while searching for first Mime Boundary");
boundaryIndex++;
}
if (boundaryIndex == boundary.length) { // boundary found
pushbackInStream.read();
break;
}
+ } else if ((byte) value == -1) {
+ throw new OMException(
+ "Mime parts not found. Stream ended while searching for the boundary");
}
} catch (IOException e1) {
throw new OMException("Stream Error" + e1.toString());
}
}
}
-
+
/**
* @return whether Message Type is SOAP with Attachments or MTOM optimised
* by checking the application type parameter in the Contant Type
@@ -143,33 +147,37 @@
this.applicationType = SWA_TYPE;
} else {
throw new OMException(
- "Invalid Application type. Support available for MTOM & SwA only.");
+ "Invalid Application type. Support available for MTOM & SwA only.");
}
}
return this.applicationType;
}
-
+
/**
- * @return the InputStream which includes the SOAP Envelope
- * We assumes that the root mime part is always pointed by "start" parameter in content-type
- */
- public InputStream getSOAPPartInputStream() throws OMException{
- String rootContentID = contentType.getParameter("start");
- rootContentID.substring(1, (rootContentID.length()-1));
- rootContentID.trim();
- DataHandler dh;
+ * @return the InputStream which includes the SOAP Envelope We assumes that
+ * the root mime part is always pointed by "start" parameter in
+ * content-type
+ */
+ public InputStream getSOAPPartInputStream() throws OMException {
+ String rootContentID = contentType.getParameter("start");
+ rootContentID.trim();
+ rootContentID = rootContentID
+ .substring(1, (rootContentID.length() - 1));
+
+ DataHandler dh;
try {
dh = getDataHandler(rootContentID);
- if (dh==null)
- {
- throw new OMException("Mandatory Root MIME part containing the SOAP Envelope is missing");
+ if (dh == null) {
+ throw new OMException(
+ "Mandatory Root MIME part containing the SOAP Envelope is missing");
}
return dh.getInputStream();
} catch (IOException e) {
- throw new OMException("Problem with DataHandler of the Root Mime Part. "+e);
+ throw new OMException(
+ "Problem with DataHandler of the Root Mime Part. " + e);
}
}
-
+
/**
* @param blobContentID
* @return The DataHandler of the mime part refered by the content-Id
@@ -179,11 +187,13 @@
* the getNextPart() till we find the required part.
*/
public DataHandler getDataHandler(String blobContentID) throws OMException {
-
+
Part bodyPart;
- blobContentID = "<"+blobContentID+">";
+ blobContentID = "<" + blobContentID + ">";
boolean attachmentFound = false;
-
+
+ // // without the following part a Null Pointer Exception is thrown
+ //
if (bodyPartsMap.containsKey(blobContentID)) {
bodyPart = (Part) bodyPartsMap.get(blobContentID);
attachmentFound = true;
@@ -191,7 +201,8 @@
try {
dh = bodyPart.getDataHandler();
} catch (MessagingException e) {
- throw new OMException("Problem with Mime Body Part No "+partIndex+". "+e);
+ throw new OMException("Problem with Mime Body Part No "
+ + partIndex + ". " + e);
}
return dh;
} else {
@@ -204,40 +215,50 @@
if (bodyPartsMap.containsKey(blobContentID)) {
bodyPart = (Part) bodyPartsMap.get(blobContentID);
DataHandler dh = bodyPart.getDataHandler();
- return dh;
+ return dh;
}
}
} catch (MessagingException e) {
throw new OMException("Invalid Mime Message " + e.toString());
}
}
-
+
}
-
+
/**
* @return The next MIME Body part in the stream Uses the MimeBodyPartStream
* to obtain streams delimited by boundaries.
* @throws MessagingException
*/
// TODO do we need Locking for this
- private MimeBodyPart getMimeBodyPart() throws OMException{
+ private MimeBodyPart getMimeBodyPart() throws OMException {
MimeBodyPart mimeBodyPart = null;
-
- //TODO A private methode to read a line
+
//String Line = pushbackInStream.readLine();
- MimeBodyPartInputStream partStream = new MimeBodyPartInputStream(
- pushbackInStream, boundary);
-
+ MimeBodyPartInputStream partStream;
+ try {
+ if (pushbackInStream.available() > 0) {
+ partStream = new MimeBodyPartInputStream(pushbackInStream,
+ boundary);
+ } else {
+ throw new OMException(
+ "Attachment not found. End of Stream reached");
+ }
+ } catch (IOException e1) {
+ throw new OMException("Attachement not found. Problem with Stream");
+ }
+
try {
mimeBodyPart = new MimeBodyPart(partStream);
} catch (MessagingException e) {
- throw new OMException("Problem reading Mime Part No "+(partIndex+1)+". "+e);
+ throw new OMException("Problem reading Mime Part No "
+ + (partIndex + 1) + ". " + e);
}
-
+
partIndex++;
return mimeBodyPart;
}
-
+
/**
* @return The Mime body part which contains the SOAP Envelope In MTOM case
* it is the first part In SwA case we assumes it to be first
@@ -254,7 +275,7 @@
}
return rootMimeBodyPart;
}
-
+
private MimeBodyPart getNextMimeBodyPart() throws OMException {
MimeBodyPart nextMimeBodyPart;
nextMimeBodyPart = getMimeBodyPart();
@@ -262,14 +283,16 @@
String partContentID;
try {
partContentID = nextMimeBodyPart.getContentID();
- // TODO we might need to trim the surrounding "<"">" from content ID
- bodyPartsMap.put(partContentID, nextMimeBodyPart);
- return nextMimeBodyPart;
+
+ bodyPartsMap.put(partContentID, nextMimeBodyPart);
+ return nextMimeBodyPart;
} catch (MessagingException e) {
- throw new OMException("Error Reading Content-ID from Mime Part No "+partIndex+". "+e);
+ throw new OMException(
+ "Error Reading Content-ID from Mime Part No "
+ + partIndex + ". " + e);
}
} else
return null;
}
-
+
}
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/MimeBodyPartInputStream.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/MimeBodyPartInputStream.java?rev=191758&r1=191757&r2=191758&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/MimeBodyPartInputStream.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/MimeBodyPartInputStream.java Tue Jun 21 20:53:35 2005
@@ -24,45 +24,76 @@
* @author <a href="mailto:thilina@opensource.lk">Thilina Gunarathne </a>
* This class provides input streams delimited by the mime boundaries.
*/
+
public class MimeBodyPartInputStream extends InputStream {
PushbackInputStream inStream;
-
+
+ boolean boundaryFound = false;
+
byte[] boundary;
-
+
public MimeBodyPartInputStream(PushbackInputStream inStream, byte[] boundary) {
super();
this.inStream = inStream;
this.boundary = boundary;
}
-
+
public int read() throws IOException {
-
+ if (boundaryFound) {
+ return -1;
+ }
// read the next value from stream
int value = inStream.read();
-
- //read value is not the first byte of the boundary
- if ((byte) value != boundary[0]) {
+
+ // A problem occured because all the mime parts tends to have a /r/n at the end. Making it hard to transform them to correct DataSources.
+ // This logic introduced to handle it
+ //TODO look more in to this && for a better way to do this
+ if (value == 13) {
+ value = inStream.read();
+ if (value != 10) {
+ inStream.unread(value);
+ return 13;
+ } else {
+ value = inStream.read();
+ if ((byte) value != boundary[0]) {
+ inStream.unread(value);
+ inStream.unread(10);
+ return 13;
+ }
+ }
+ } else if ((byte) value != boundary[0]) {
return value;
}
-
+
// read value is the first byte of the boundary. Start matching the
// next characters to find a boundary
- int boundaryIndex = 0;
+ int boundaryIndex = 0;
while ((boundaryIndex < boundary.length)
&& ((byte) value == boundary[boundaryIndex])) {
value = inStream.read();
boundaryIndex++;
}
-
+
if (boundaryIndex == boundary.length) { // boundary found
+ boundaryFound = true;
+ // read the end of line character
+ if (inStream.read() == 45) {
+ //check whether end of stream
+ //Last mime boundary should have a succeeding "--"
+ if (!((value = inStream.read()) == 45)) {
+ inStream.unread(value);
+ }
+
+ }
+
return -1;
}
-
+
// Boundary not found. Restoring bytes skipped.
// write first skipped byte, push back the rest
-
+
if (value != -1) { // Stream might have ended
- inStream.unread(value);
+ inStream.unread(value);
}
inStream.unread(boundary, 1, boundaryIndex - 1);
return boundary[0];
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/PartOnFile.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/PartOnFile.java?rev=191758&r1=191757&r2=191758&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/PartOnFile.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/attachments/PartOnFile.java Tue Jun 21 20:53:35 2005
@@ -32,216 +32,266 @@
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public class PartOnFile implements Part {
-
+
String fileName;
+
Part bodyPart;
- public PartOnFile(Part bodyPart) throws Exception{
+
+ public PartOnFile(Part bodyPart) throws Exception {
super();
- fileName = (new Date()).getTime()+".tmp";
+ fileName = (new Date()).getTime() + ".tmp";
FileOutputStream outFileStream;
outFileStream = new FileOutputStream(fileName);
bodyPart.writeTo(outFileStream);
outFileStream.close();
}
-
+
public int getSize() throws MessagingException {
// TODO Auto-generated method stub
return 0;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#getLineCount()
*/
public int getLineCount() throws MessagingException {
// TODO Auto-generated method stub
return 0;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#getContentType()
*/
public String getContentType() throws MessagingException {
// TODO Auto-generated method stub
return null;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#isMimeType(java.lang.String)
*/
public boolean isMimeType(String arg0) throws MessagingException {
// TODO Auto-generated method stub
return false;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#getDisposition()
*/
public String getDisposition() throws MessagingException {
// TODO Auto-generated method stub
return null;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#setDisposition(java.lang.String)
*/
public void setDisposition(String arg0) throws MessagingException {
// TODO Auto-generated method stub
-
+
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#getDescription()
*/
public String getDescription() throws MessagingException {
// TODO Auto-generated method stub
return null;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#setDescription(java.lang.String)
*/
public void setDescription(String arg0) throws MessagingException {
// TODO Auto-generated method stub
-
+
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#getFileName()
*/
public String getFileName() throws MessagingException {
// TODO Auto-generated method stub
return null;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#setFileName(java.lang.String)
*/
public void setFileName(String arg0) throws MessagingException {
// TODO Auto-generated method stub
-
+
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#getInputStream()
*/
public InputStream getInputStream() throws IOException, MessagingException {
// TODO Auto-generated method stub
return null;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#getDataHandler()
*/
public DataHandler getDataHandler() throws MessagingException {
// TODO Auto-generated method stub
return null;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#getContent()
*/
public Object getContent() throws IOException, MessagingException {
// TODO Auto-generated method stub
return null;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#setDataHandler(javax.activation.DataHandler)
*/
public void setDataHandler(DataHandler arg0) throws MessagingException {
// TODO Auto-generated method stub
-
+
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#setContent(java.lang.Object, java.lang.String)
*/
public void setContent(Object arg0, String arg1) throws MessagingException {
// TODO Auto-generated method stub
-
+
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#setText(java.lang.String)
*/
public void setText(String arg0) throws MessagingException {
// TODO Auto-generated method stub
-
+
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#setContent(javax.mail.Multipart)
*/
public void setContent(Multipart arg0) throws MessagingException {
// TODO Auto-generated method stub
-
+
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#writeTo(java.io.OutputStream)
*/
public void writeTo(OutputStream arg0) throws IOException,
- MessagingException {
+ MessagingException {
// TODO Auto-generated method stub
-
+
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#getHeader(java.lang.String)
*/
public String[] getHeader(String arg0) throws MessagingException {
// TODO Auto-generated method stub
return null;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#setHeader(java.lang.String, java.lang.String)
*/
public void setHeader(String arg0, String arg1) throws MessagingException {
// TODO Auto-generated method stub
-
+
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#addHeader(java.lang.String, java.lang.String)
*/
public void addHeader(String arg0, String arg1) throws MessagingException {
// TODO Auto-generated method stub
-
+
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#removeHeader(java.lang.String)
*/
public void removeHeader(String arg0) throws MessagingException {
// TODO Auto-generated method stub
-
+
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#getAllHeaders()
*/
public Enumeration getAllHeaders() throws MessagingException {
// TODO Auto-generated method stub
return null;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#getMatchingHeaders(java.lang.String[])
*/
public Enumeration getMatchingHeaders(String[] arg0)
- throws MessagingException {
+ throws MessagingException {
// TODO Auto-generated method stub
return null;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see javax.mail.Part#getNonMatchingHeaders(java.lang.String[])
*/
public Enumeration getNonMatchingHeaders(String[] arg0)
- throws MessagingException {
+ throws MessagingException {
// TODO Auto-generated method stub
return null;
}
-
-}
+
+}
\ No newline at end of file