本文整理汇总了Java中com.google.gdata.data.OtherContent.setMimeType方法的典型用法代码示例。如果您正苦于以下问题:Java OtherContent.setMimeType方法的具体用法?Java OtherContent.setMimeType怎么用?Java OtherContent.setMimeType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gdata.data.OtherContent
的用法示例。
在下文中一共展示了OtherContent.setMimeType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPhoto
import com.google.gdata.data.OtherContent; //导入方法依赖的package包/类
private void createPhoto(AlbumEntry albumEntry) throws Exception {
PhotoEntry photo = new PhotoEntry();
String title = getString("Title");
photo.setTitle(new PlainTextConstruct(title));
String description = getString("Description");
photo.setDescription(new PlainTextConstruct(description));
photo.setTimestamp(new Date());
OtherContent content = new OtherContent();
File file = null;
while (file == null || !file.canRead()) {
file = new File(getString("Photo location"));
}
content.setBytes(getBytes(file));
content.setMimeType(new ContentType("image/jpeg"));
photo.setContent(content);
insert(albumEntry, photo);
}
示例2: createXmlContent
import com.google.gdata.data.OtherContent; //导入方法依赖的package包/类
/**
* Converts XML text to a GData {@code OtherContent} description of the
* payload
* @param xmlSource XML source of the payload
* @return A GData {@code OtherContent} representation of the payload
*/
public OtherContent createXmlContent(String xmlSource) {
OtherContent xmlContent = new OtherContent();
XmlBlob xmlBlob = new XmlBlob();
xmlBlob.setBlob(xmlSource);
xmlContent.setXml(xmlBlob);
xmlContent.setMimeType(APPLICATION_XML);
return xmlContent;
}
示例3: FeedServerClientTestUtil
import com.google.gdata.data.OtherContent; //导入方法依赖的package包/类
/**
* Populates bean with static info to match XML. The XML and the bean should
* be interchangable using utilities provided by FeedServerClient.
*/
public FeedServerClientTestUtil() {
// Setup sample bean.
sampleVehicleBean = new VehicleBean();
sampleVehicleBean.setName(NAME);
sampleVehicleBean.setOwner(OWNER);
sampleVehicleBean.setPrice(PRICE);
sampleVehicleBean.setPropertyName(PROPERTY_NAMES);
sampleVehicleBean.setPropertyValue(PROPERTY_VALUES);
// Setup sample map.
sampleVehicleMap = new HashMap<String, Object>();
sampleVehicleMap.put("name", NAME);
sampleVehicleMap.put("owner", OWNER);
sampleVehicleMap.put("price", PRICE);
sampleVehicleMap.put("propertyName", PROPERTY_NAMES);
sampleVehicleMap.put("propertyValue", PROPERTY_VALUES);
// Create populated gdata entry.
XmlBlob xmlBlob = new XmlBlob();
xmlBlob.setBlob(ENTRY_XML);
OtherContent xmlContent = new OtherContent();
xmlContent.setXml(xmlBlob);
xmlContent.setXml(xmlBlob);
xmlContent.setMimeType(ContentUtil.APPLICATION_XML);
vehicleEntry = new FeedServerEntry();
vehicleEntry.setXmlBlob(xmlBlob);
vehicleEntry.setContent(xmlContent);
}
示例4: setKml
import com.google.gdata.data.OtherContent; //导入方法依赖的package包/类
/**
* Sets the KML content of the feature as an XmlBlob. Unless
* overridden by setKmlDefault, the default namespace of the entry
* is kml, so the KML placemarks don't need any namespace prefix.
*
* @param kml A string representing a KML placemark.
*/
public void setKml(XmlBlob kml) {
OtherContent content = new OtherContent();
content.setXml(kml);
content.setMimeType(KML_CONTENT);
setContent(content);
}