@Override public MimeBodyPart createMimeBodyPart(InternetHeaders headers, byte [] content) throws MessagingException { return new MediaBodyPart(headers, content); }
/** * Returns {@code true} if the body part contains Atom data. */ public boolean isAtomPart() throws MessagingException { return isMimeType("application/atom+xml"); }
public MediaBodyPart(IEntry entry) throws MessagingException { super(); setContent(entry, "application/atom+xml"); setHeader("Content-Type", "application/atom+xml"); }
public MediaBodyPart(InternetHeaders headers, byte [] content) throws MessagingException { super(headers, content); // javax.mail.util.SharedByteArrayInputStream here. String contentType = getContentType(); MediaStreamSource mediaStreamSource = new MediaStreamSource(new ByteArrayInputStream(content), contentType); String etag = getHeader(GDataProtocol.Header.ETAG, null); if (etag != null) { mediaStreamSource.setEtag(etag); } mediaSource = mediaStreamSource; initMediaDataHandler(); }
public MediaBodyPart(MediaSource mediaSource) throws MessagingException { super(); this.mediaSource = mediaSource; //headers.setHeader("Content-Type", mediaSource.getContentType()); setHeader("Content-Type", mediaSource.getContentType()); String etag = mediaSource.getEtag(); if (etag != null) { setHeader(GDataProtocol.Header.ETAG, etag); } initMediaDataHandler(); }
public MediaBodyPart(InputStream is) throws MessagingException { // Process the headers from the input stream super(new InternetHeaders(is), null); // Create a media stream source to read the remaining data, using the // content type information from the headers. mediaSource = new MediaStreamSource(is, getContentType()); initMediaDataHandler(); }
/** * Initializes the {@link DataHandler} associated with the body part * when it contains media content. */ private void initMediaDataHandler() throws MessagingException { // Cannot call setDataHandler() because it invalidates header data // Fortunately, 'dh' is a protected field on the base class. if (!isAtomPart()) { // For media content, simply wrap the media source. dh = new MediaSourceDataHandler(mediaSource); } else { // For Atom content, use standard Java activation handling. dh = new DataHandler(mediaSource); } }
public MediaBodyPart(InternetHeaders headers, byte [] content) throws MessagingException { super(headers, content); // javax.mail.util.SharedByteArrayInputStream here. String contentType = getContentType(); MediaStreamSource mediaStreamSource = new MediaStreamSource(new ByteArrayInputStream(content), contentType); String etag = getHeader(GDataProtocol.Header.ETAG, null); if (etag != null) { mediaStreamSource.setEtag(etag); } mediaSource = mediaStreamSource; initMediaDataHandler(); }
public MediaBodyPart(MediaSource mediaSource) throws MessagingException { super(); this.mediaSource = mediaSource; //headers.setHeader("Content-Type", mediaSource.getContentType()); setHeader("Content-Type", mediaSource.getContentType()); String etag = mediaSource.getEtag(); if (etag != null) { setHeader(GDataProtocol.Header.ETAG, etag); } initMediaDataHandler(); }
public MediaBodyPart(InputStream is) throws MessagingException { // Process the headers from the input stream super(new InternetHeaders(is), null); // Create a media stream source to read the remaining data, using the // content type information from the headers. mediaSource = new MediaStreamSource(is, getContentType()); initMediaDataHandler(); }
/** * Initializes the {@link DataHandler} associated with the body part * when it contains media content. */ private void initMediaDataHandler() throws MessagingException { // Cannot call setDataHandler() because it invalidates header data // Fortunately, 'dh' is a protected field on the base class. if (!isAtomPart()) { // For media content, simply wrap the media source. dh = new MediaSourceDataHandler(mediaSource); } else { // For Atom content, use standard Java activation handling. dh = new DataHandler(mediaSource); } }
public MediaBodyPart(IEntry entry) throws MessagingException { super(); setContent(entry, "application/atom+xml"); setHeader("Content-Type", "application/atom+xml"); }
@Override public MimeBodyPart createMimeBodyPart(InputStream is) throws MessagingException { return new MediaBodyPart(is); }
/** * Returns {@code true} if the body part contains Atom data. */ public boolean isAtomPart() throws MessagingException { return isMimeType("application/atom+xml"); }
@Override public MimeBodyPart createMimeBodyPart(InternetHeaders headers, byte [] content) throws MessagingException { return new MediaBodyPart(headers, content); }
@Override public MimeBodyPart createMimeBodyPart(InputStream is) throws MessagingException { return new MediaBodyPart(is); }
/** * Constructs a new MediaMultipart instance from an Atom entry instance * and a media source. */ public MediaMultipart(IEntry entry, MediaSource media) throws MessagingException { super("related"); Preconditions.checkNotNull(entry, "entry"); Preconditions.checkNotNull(media, "media"); atomPart = new MediaBodyPart(entry); addBodyPart(atomPart); mediaPart = new MediaBodyPart(media); addBodyPart(mediaPart); }
/** * Constructs a new MediaMultipart instance from an Atom entry instance * and a media source. */ public MediaMultipart(IEntry entry, MediaSource media) throws MessagingException { super("related"); Preconditions.checkNotNull(entry, "entry"); Preconditions.checkNotNull(media, "media"); atomPart = new MediaBodyPart(entry); addBodyPart(atomPart); mediaPart = new MediaBodyPart(media); addBodyPart(mediaPart); }