{"id":254,"date":"2010-09-12T23:51:58","date_gmt":"2010-09-12T14:51:58","guid":{"rendered":"http:\/\/www.typea.info\/blog\/index.php\/2010\/09\/12\/android_mime\/"},"modified":"2010-09-12T23:51:58","modified_gmt":"2010-09-12T14:51:58","slug":"android_mime","status":"publish","type":"post","link":"https:\/\/www.typea.info\/blog\/index.php\/2010\/09\/12\/android_mime\/","title":{"rendered":"Android MIME\u30de\u30eb\u30c1\u30d1\u30fc\u30c8\u3067\u30d5\u30a1\u30a4\u30eb\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b"},"content":{"rendered":"<p><a href=\"http:\/\/developer.android.com\/reference\/org\/apache\/http\/entity\/AbstractHttpEntity.html\">AbstractHttpEntry<\/a> \u3092\u898b\u308b\u3068\u3001SDK Platform Android 2.1, API 7, revision 1&nbsp; \u306b\u306f\u3001MIME\u30de\u30eb\u30c1\u30d1\u30fc\u30c8\u3092\u5229\u7528\u3059\u308b\u305f\u3081\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306f\u540c\u68b1\u3055\u308c\u3066\u3044\u306a\u3044\u3088\u3046\u3060\u3002<\/p>\n<p><a href=\"http:\/\/blog.tacticalnuclearstrike.com\/2010\/01\/using-multipartentity-in-android-applications\/\">\u3053\u306e\u30d6\u30ed\u30b0<\/a>\u3092\u53c2\u8003(\u5b8c\u5168\u306b\u305d\u306e\u307e\u307e)\u306b\u3001Android \u304b\u3089\u3001\u30d5\u30a1\u30a4\u30eb\u3092MIME\u30de\u30eb\u30c1\u30d1\u30fc\u30c8\u3067\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3066\u307f\u308b\u3002<\/p>\n<p>\u307e\u305a\u3001\u4e0a\u8ff0\u306e\u3088\u3046\u306b\u6a5f\u80fd\u304c\u540c\u68b1\u3055\u308c\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u30fc\u3092\u5165\u624b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u305d\u3046\u3060\u3002<\/p>\n<ul>\n<li><a href=\"http:\/\/james.apache.org\/download.cgi#Apache_Mime4J\">apache-mime4j<\/a> <\/li>\n<li><a href=\"http:\/\/hc.apache.org\/downloads.cgi\">httpclient<\/a> <\/li>\n<li><a href=\"http:\/\/hc.apache.org\/downloads.cgi\">httpcore<\/a> <\/li>\n<li><a href=\"http:\/\/hc.apache.org\/downloads.cgi\">httpmime<\/a> <\/li>\n<\/ul>\n<p>\u4eca\u56de\u306f\u3001\u4ee5\u4e0b\u306e3\u3064\u306e\u30a2\u30fc\u30ab\u30a4\u30d6\u3092\u5165\u624b<\/p>\n<ul>\n<li><a href=\"http:\/\/james.apache.org\/download.cgi#Apache_Mime4J\">apache-mime4j-0.6-bin.zip<\/a> <\/li>\n<li><a href=\"http:\/\/hc.apache.org\/downloads.cgi\">httpcomponents-client-4.0.2-bin.zip<\/a> <\/li>\n<li><a href=\"http:\/\/hc.apache.org\/downloads.cgi\">httpcomponents-core-4.0.1-bin.zip<\/a> <\/li>\n<\/ul>\n<p>httpmime \u306f\u3001httpcomponents-client \u306b httpclient \u3068\u3068\u3082\u306b\u30a2\u30fc\u30ab\u30a4\u30d6\u3055\u308c\u3066\u3044\u308b\u3002<\/p>\n<p>\u3067\u3001\u305d\u308c\u305e\u308c\u89e3\u51cd\u3057\u3066\u3001\u4ee5\u4e0b\u306e jar \u30d5\u30a1\u30a4\u30eb\u3092 Android \u30a2\u30d7\u30ea\u306e libs \u30d5\u30a9\u30eb\u30c0\u306b\u7f6e\u3044\u3066\u3042\u3052\u308b\u3002<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/AndroidMIME_14582\/mime_android01.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"mime_android01\" border=\"0\" alt=\"mime_android01\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/AndroidMIME_14582\/mime_android01_thumb.jpg\" width=\"437\" height=\"156\" \/><\/a> <\/p>\n<p>\u3046\u30fc\u3093\u3001\u516c\u958b\u3057\u3066\u3044\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u81ea\u4f53\u306e\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u304c\u3001118KB \u306a\u306e\u3092\u8003\u3048\u308b\u3068\u3001\u7d50\u69cb\u30b5\u30a4\u30ba\u304c\u5927\u304d\u3044\u3067\u3059\u306d\u3002\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u3068\u306f\u9055\u3063\u3066\u3001\u6c17\u306b\u306a\u308a\u307e\u3059\u306d\u3002<\/p>\n<p>\u4e0a\u8a18\u30d6\u30ed\u30b0\u3067\u306f\u8a00\u53ca\u3055\u308c\u3066\u3044\u306a\u3044\u3001httpcore-nio-4.0.1.jar \u306f\u3044\u308b\u306e\u304b\u306a\uff1f<\/p>\n<p>\u306f\u305a\u3057\u3066\u52d5\u304f\u3088\u3046\u306a\u3089\u3001\u306f\u305a\u3057\u3061\u3083\u304a\u3046\u3002<\/p>\n<pre class=\"prettyprint linenums\">DefaultHttpClient client = new DefaultHttpClient();\r\nHttpPost httpPost = new HttpPost(uri);\r\nFile upfile = new File(info.getPath());\r\n\r\nMultipartEntity entity = new MultipartEntity();\r\nentity.addPart(\"upload_file_name\",     new StringBody(upfile.getName()));\r\nentity.addPart(\"upload_file_contents\", new FileBody(upfile));\r\nhttpPost.setEntity(entity);\r\nresponse = client.execute(httpPost);<\/pre>\n<p>\u3042\u3068\u306f\u3001\u3053\u308c\u3060\u3051\u3002<\/p>\n<p>\u7121\u4e8b\u3001\u9001\u4fe1\u3067\u304d\u308b\u3053\u3068\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u307e\u305f\u4e00\u6b69\u91ce\u671b\u306b\u8fd1\u3065\u3044\u305f\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>AbstractHttpEntry \u3092\u898b\u308b\u3068\u3001SDK Platform Android 2.1, API 7, revision 1&nbsp; \u306b\u306f\u3001MIME\u30de\u30eb\u30c1\u30d1\u30fc\u30c8\u3092\u5229\u7528\u3059\u308b\u305f\u3081\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306f\u540c\u68b1\u3055\u308c\u3066\u3044\u306a\u3044\u3088\u3046 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[39],"tags":[],"class_list":["post-254","post","type-post","status-publish","format-standard","hentry","category-android"],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/254","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=254"}],"version-history":[{"count":0,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/254\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}