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(); }
@Override public MimeBodyPart createMimeBodyPart(InputStream is) throws MessagingException { return new MediaBodyPart(is); }
/** * Returns an adapted entry that is a subclass of GphotoEntry. */ @Override public GphotoEntry<?> getAdaptedEntry() throws AdaptorException { return (GphotoEntry<?>) super.getAdaptedEntry(); }
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(); }
public MediaBodyPart(IEntry entry) throws MessagingException { super(); setContent(entry, "application/atom+xml"); setHeader("Content-Type", "application/atom+xml"); }
// read all photos from an album URL feedUrl = "https://picasaweb.google.com/data/feed/api/user/username/albumid/albumid"; AlbumFeed feed = myService.getFeed(feedUrl, AlbumFeed.class); for(PhotoEntry photo : feed.getPhotoEntries()) { MediaSource mediaSource = photo.getMediaSource(); InputStream photoInputStream = mediaSource.getInputStream(); // read from the photoInputStream here to get contents of photo }
/** * Gets the link with which you can open up the document in a Web * browser. This is a link to the full document-specific UI (for * edit if the requesting user has edit permission, and a read-only * HTML rendering otherwise). * * @return a link to open up the web browser with */ public Link getDocumentLink() { return super.getHtmlLink(); }
/** * Generates output for requests that target media resources. */ public void generate(OutputStream contentStream, OutputProperties request, MediaSource source) throws IOException { MediaSource.Output.writeTo(source, contentStream); } }
/** Retrieves the media resource edit link. */ @Override @SuppressWarnings("deprecation") public Link getMediaEditLink() { Link mediaLink = getLink(Link.Rel.MEDIA_EDIT, null); if (mediaLink == null) { // Temporary back compat support for old incorrect media link value. // to the new value. mediaLink = getLink(Link.Rel.MEDIA_EDIT_BACKCOMPAT, null); } return mediaLink; }
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(); }
/** * Gets the link with which you can open up the document in a Web * browser. This is a link to the full document-specific UI (for * edit if the requesting user has edit permission, and a read-only * HTML rendering otherwise). * * @return a link to open up the web browser with */ public Link getDocumentLink() { return super.getHtmlLink(); }
@Override public MimeBodyPart createMimeBodyPart(InternetHeaders headers, byte [] content) throws MessagingException { return new MediaBodyPart(headers, content); }
/** * Generates output for requests that target media resources. */ public void generate(OutputStream contentStream, OutputProperties request, MediaSource source) throws IOException { MediaSource.Output.writeTo(source, contentStream); } }
/** * Returns an adapted entry that is a subclass of GphotoEntry. */ @Override public GphotoEntry<?> getAdaptedEntry() throws AdaptorException { return (GphotoEntry<?>) super.getAdaptedEntry(); }
/** Retrieves the media resource edit link. */ @Override @SuppressWarnings("deprecation") public Link getMediaEditLink() { Link mediaLink = getLink(Link.Rel.MEDIA_EDIT, null); if (mediaLink == null) { // Temporary back compat support for old incorrect media link value. // to the new value. mediaLink = getLink(Link.Rel.MEDIA_EDIT_BACKCOMPAT, null); } return mediaLink; }
/** * Gets the link with which you can open up the document in a Web * browser. This is a link to the full document-specific UI (for * edit if the requesting user has edit permission, and a read-only * HTML rendering otherwise). * * @return a link to open up the web browser with */ public Link getDocumentLink() { return super.getHtmlLink(); }
@Override public MimeBodyPart createMimeBodyPart(InternetHeaders headers, byte [] content) throws MessagingException { return new MediaBodyPart(headers, content); }
@Override public void writeTo(OutputStream os) throws IOException { MediaSource.Output.writeTo(source, os); } }
@Override public MimeBodyPart createMimeBodyPart(InputStream is) throws MessagingException { return new MediaBodyPart(is); }