{"id":249,"date":"2012-07-12T01:25:20","date_gmt":"2012-07-11T16:25:20","guid":{"rendered":"http:\/\/appsweets.net\/blog\/?p=249"},"modified":"2012-07-12T01:26:37","modified_gmt":"2012-07-11T16:26:37","slug":"file-io-6-write","status":"publish","type":"post","link":"https:\/\/appsweets.net\/blog\/2012\/07\/12\/file-io-6-write\/","title":{"rendered":"file i\/o #6: write"},"content":{"rendered":"<div class=\"db9cc8cdb64025d13c1cc9dad0a0e262\" data-index=\"1\" style=\"float: left; margin: 16px 16px 16px 0;\">\n<script type=\"text\/javascript\"><!--\r\ngoogle_ad_client = \"ca-pub-5825700137064158\";\r\n\/* 250sq, appsweets-blog *\/\r\ngoogle_ad_slot = \"4837931762\";\r\ngoogle_ad_width = 250;\r\ngoogle_ad_height = 250;\r\n\/\/-->\r\n<\/script>\r\n<script type=\"text\/javascript\"\r\nsrc=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\r\n<\/script>\n<\/div>\n<p>\u7d50\u5c40\u306e\u3068\u3053\u308d\u3001HTTP PUT \u3067\u4fdd\u5b58\u3059\u308b\u3088\u3046\u306b\u3057\u305f\u3002<\/p>\n<p>jsOAuth \u306f\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u751f\u6210\u3059\u308b\u305f\u3081\u306e\u30e1\u30bd\u30c3\u30c9\u3068\u3057\u3066\u3001\u3088\u308a\u9ad8\u4f4d\u306a\u9806\u306b<\/p>\n<ul>\n<li>fetchRequestToken()\u3001fetchAccessToken()<\/li>\n<li>get()\u3001post()\u3001postJSON()<\/li>\n<li>request()<\/li>\n<\/ul>\n<p>\u3092\u63d0\u4f9b\u3057\u3066\u3044\u308b\u3002PUT \u306f\u306a\u3044\u306e\u3067\u65b0\u3057\u304f put() \u3092\u66f8\u304f\u304b\u3001request() \u3092\u76f4\u63a5\u547c\u3073\u51fa\u3059\u5fc5\u8981\u304c\u3042\u308b\u3002\u304c request \u81ea\u4f53\u304c PUT \u306b\u5fae\u5999\u306b\u5bfe\u5fdc\u3057\u5fd8\u308c\u3066\u3044\u308b\u7b87\u6240\u304c\u3042\u308b\u306e\u3067\u305d\u3053\u306f\u3061\u3087\u3053\u3061\u3087\u3053\u3063\u3068\u4fee\u6b63\u3059\u308b\u5fc5\u8981\u306f\u3042\u308b\u3002<\/p>\n<p>\u3055\u3066 jsOAuth \u3092\u4f7f\u3063\u305f\u3068\u3057\u3066\u3082\u3001dropbox \u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u30c8\u30e9\u30f3\u30b9\u30dd\u30fc\u30c8\u306f\u3064\u307e\u308b\u3068\u3053\u308d XMLHttpRequest \u306a\u306e\u3060\u304c\u3001xhr \u3067 PUT \u3059\u308b\u5834\u5408\u3001\u3064\u307e\u308a open() \u6642\u306b &#8216;PUT&#8217; \u3092\u6307\u5b9a\u3057\u3066 send() \u6642\u306b\u6587\u5b57\u5217\u3092\u5f15\u6570\u306b\u3057\u305f\u5834\u5408\u3001\u305d\u306e\u6587\u5b57\u5217\u306f UTF-8 \u306e\u30d0\u30a4\u30c8\u5217\u306b\u5909\u63db\u3055\u308c\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u81ea\u4f53\u304c Content-Type: text\/plain;charset=UTF-8 \u3068\u307f\u306a\u3055\u308c\u308b\uff08<a href=\"http:\/\/www.w3.org\/TR\/XMLHttpRequest\/#the-send-method\" target=\"_blank\">\u4ed5\u69d8<\/a>\uff09\u3002\u3053\u308c\u3067\u306f\u3001UTF-8 \u4ee5\u5916\u306e\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306b\u5bfe\u5fdc\u3067\u304d\u306a\u3044\u3002<\/p>\n<p>send() \u306e\u5f15\u6570\u3068\u3057\u3066\u6587\u5b57\u5217\u3067\u306f\u306a\u304f\u3001\u4efb\u610f\u306e\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306e\u30d0\u30a4\u30c8\u5217\u306b\u5909\u63db\u3057\u305f ArrayBuffer \u306b\u3059\u308c\u3070\u3001\u3053\u306e\u5236\u9650\u306f\u8fc2\u56de\u3067\u304d\u308b\u3002\u6700\u65b0\u306e API \u306e\u5b9f\u88c5\u5ea6\u306b\u95a2\u3057\u3066\u306f Chrome \u3068 Firefox \u306b\u5bfe\u3057\u3066\u3060\u3044\u305f\u3044 2 \u5468\u9045\u308c\u3067\u3042\u308b\u3068\u3053\u308d\u306e Opera \u3082\u304b\u308d\u3046\u3058\u3066 ArrayBuffer \u304f\u3089\u3044\u306f\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u3002\u3057\u304b\u3057 javascript \u3067\u306f\u81ea\u524d\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u7528\u610f\u3059\u308b\u307b\u304b\u306b UTF-16 \u304b\u3089\u4efb\u610f\u306e\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3078\u5909\u66f4\u3059\u308b\u624b\u6bb5\u304c\u306a\u3044\u3002\u3069\u306e\u30d6\u30e9\u30a6\u30b6\u3082\u5185\u90e8\u3067\u306f UTF-16 \u3067\u30c6\u30ad\u30b9\u30c8\u3092\u4fdd\u6301\u3057\u3001\u81ea\u8eab\u304c\u3055\u307e\u3056\u307e\u306a\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092 UTF-16 \u3078\u5909\u63db\u3059\u308b\u305f\u3081\u306e\u6a5f\u69cb\u3092\u5099\u3048\u3066\u3044\u308b\u306e\u3060\u304b\u3089\u3001\u305d\u308c\u3092\u5229\u7528\u3057\u305f\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092 javascript \u306b\u516c\u958b\u3057\u3066\u304f\u308c\u3066\u3082\u3044\u3044\u306e\u306b\u3001\u306a\u3044\u306e\u3060\uff08Firefox \u306f\u305f\u3076\u3093\u3042\u308b\uff09\u3002<\/p>\n<p>\u3053\u308c\u3092\u89e3\u6c7a\u3059\u308b\u306b\u306f\u3001dropbox \u3068\u306e\u3084\u308a\u53d6\u308a\u81ea\u4f53\u3092\u3001\u30d6\u30e9\u30a6\u30b6\u3068 dropbox \u9593\u3067\u76f4\u63a5\u3067\u306f\u306a\u304f\u3001\u3053\u3053\u306e\u30b5\u30fc\u30d0\u3092\u7d4c\u7531\u3055\u305b\u3001\u30b5\u30fc\u30d0\u4e0a\u3067\u9069\u5b9c\u9069\u5f53\u306a\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3078\u5909\u63db\u3055\u305b\u3064\u3064\u884c\u3046\u5fc5\u8981\u304c\u3042\u308b\u3002\u30d6\u30e9\u30a6\u30b6\u3068 dropbox \u3068\u306e\u3084\u308a\u3068\u308a\u3092\u4ee3\u7406\u3067\u884c\u3046\u3068\u3044\u3046\u306e\u306f\u3064\u307e\u308a\u3001OAuth \u3092\u7528\u3044\u305f\u30a2\u30af\u30bb\u30b9\u3092\u4ee3\u7406\u3067\u884c\u3046\u3068\u3044\u3046\u3053\u3068\u3060\u3002\u30b5\u30fc\u30d0\u4e0a\u3067 OAuth \u30a2\u30af\u30bb\u30b9\u3092\u884c\u3046\u306b\u306f\u5358\u306b<a href=\"http:\/\/code.google.com\/p\/oauth-php\/\" target=\"_blank\">\u3053\u308c<\/a>\u3092\u5229\u7528\u3055\u305b\u3066\u3044\u305f\u3060\u304f\u3060\u3051\u3067\u3044\u3044\u3002\u305d\u3057\u3066\u5b9f\u306f\u3053\u306e\u65b9\u304c\u3001dropbox \u304b\u3089\u5272\u308a\u5f53\u3066\u3089\u308c\u305f\u30b3\u30f3\u30b7\u30e5\u30fc\u30de \u30ad\u30fc\u3068\u30b3\u30f3\u30b7\u30e5\u30fc\u30de \u30b7\u30fc\u30af\u30ec\u30c3\u30c8\u3092\u30a8\u30af\u30b9\u30c6\u30f3\u30b7\u30e7\u30f3\u306e\u30bd\u30fc\u30b9\u5185\u306b\u57cb\u3081\u8fbc\u307e\u306a\u304f\u3066\u3082\u3044\u3044\uff08\u305d\u306e\u3042\u305f\u308a\u306e<a href=\"\nhttp:\/\/stackoverflow.com\/questions\/9187894\/secure-handling-of-oauth-consumer-key-and-secret-in-chrome-extensions-and-gmail\" target=\"_blank\">\u8cea\u554f<\/a>\uff09\u306e\u3067\u3080\u3057\u308d\u7b4b\u304c\u3088\u304b\u3063\u305f\u308a\u3059\u308b\u3002<\/p>\n<p>\u3067\u3082\u306a\u30fc dropbox \u3068\u306e\u3084\u308a\u53d6\u308a\u81ea\u4f53\u901f\u3044\u308f\u3051\u3067\u3082\u306a\u3044\u306e\u306b\u3001\u3053\u3053\u306e\u30b5\u30fc\u30d0\u3092\u7d4c\u7531\u3055\u305b\u308b\u3082\u3063\u3068\u3082\u3063\u3055\u308a\u611f\u6f02\u3046\u3053\u3068\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u306a\u30fc\u2026\u2026\u3002<\/p>\n<div class=\"db9cc8cdb64025d13c1cc9dad0a0e262\" data-index=\"1\" style=\"float: left; margin: 16px 16px 16px 0;\">\n<script type=\"text\/javascript\"><!--\r\ngoogle_ad_client = \"ca-pub-5825700137064158\";\r\n\/* 250sq, appsweets-blog *\/\r\ngoogle_ad_slot = \"4837931762\";\r\ngoogle_ad_width = 250;\r\ngoogle_ad_height = 250;\r\n\/\/-->\r\n<\/script>\r\n<script type=\"text\/javascript\"\r\nsrc=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\r\n<\/script>\n<\/div>\n\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>\u7d50\u5c40\u306e\u3068\u3053\u308d\u3001HTTP PUT \u3067\u4fdd\u5b58\u3059\u308b\u3088\u3046\u306b\u3057\u305f\u3002 jsOAuth \u306f\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u751f\u6210\u3059\u308b\u305f\u3081\u306e\u30e1\u30bd\u30c3\u30c9\u3068\u3057\u3066\u3001\u3088\u308a\u9ad8\u4f4d\u306a\u9806\u306b fetchRequestToken()\u3001fetchAccessToken() get()\u3001post()\u3001postJSON() request() \u3092\u63d0\u4f9b\u3057\u3066\u3044\u308b\u3002PUT \u306f\u306a\u3044\u306e\u3067\u65b0\u3057\u304f put() \u3092\u66f8\u304f\u304b\u3001request() \u3092\u76f4\u63a5\u547c\u3073\u51fa\u3059\u5fc5\u8981\u304c\u3042\u308b\u3002\u304c request \u81ea\u4f53\u304c PUT \u306b\u5fae\u5999\u306b\u5bfe\u5fdc\u3057\u5fd8\u308c\u3066\u3044\u308b\u7b87\u6240\u304c\u3042\u308b\u306e\u3067\u305d\u3053\u306f\u3061\u3087\u3053\u3061\u3087\u3053\u3063\u3068\u4fee\u6b63\u3059\u308b\u5fc5\u8981\u306f\u3042\u308b\u3002 \u3055\u3066 jsOAuth \u3092\u4f7f\u3063\u305f\u3068\u3057\u3066\u3082\u3001dropbox \u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u30c8\u30e9\u30f3\u30b9\u30dd\u30fc\u30c8\u306f\u3064\u307e\u308b\u3068\u3053\u308d XMLHttpRequest \u306a\u306e\u3060\u304c\u3001xhr \u3067 PUT \u3059\u308b\u5834\u5408\u3001\u3064\u307e\u308a open() \u6642\u306b &#8216;PUT&#8217; \u3092\u6307\u5b9a\u3057\u3066 send() \u6642\u306b\u6587\u5b57\u5217\u3092\u5f15\u6570\u306b\u3057\u305f\u5834\u5408\u3001\u305d\u306e\u6587\u5b57\u5217\u306f UTF-8 \u306e\u30d0\u30a4\u30c8\u5217\u306b\u5909\u63db\u3055\u308c\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u81ea\u4f53\u304c Content-Type: text\/plain;charset=UTF-8 \u3068\u307f\u306a\u3055\u308c\u308b\uff08\u4ed5\u69d8\uff09\u3002\u3053\u308c\u3067\u306f\u3001UTF-8 \u4ee5\u5916\u306e\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306b\u5bfe\u5fdc\u3067\u304d\u306a\u3044\u3002 send() \u306e\u5f15\u6570\u3068\u3057\u3066\u6587\u5b57\u5217\u3067\u306f\u306a\u304f\u3001\u4efb\u610f\u306e\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306e\u30d0\u30a4\u30c8\u5217\u306b\u5909\u63db\u3057\u305f &hellip; <a href=\"https:\/\/appsweets.net\/blog\/2012\/07\/12\/file-io-6-write\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[5,3,4],"class_list":["post-249","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-javascript","tag-vi","tag-wasavi"],"_links":{"self":[{"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/posts\/249","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/comments?post=249"}],"version-history":[{"count":5,"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/posts\/249\/revisions"}],"predecessor-version":[{"id":253,"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/posts\/249\/revisions\/253"}],"wp:attachment":[{"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/media?parent=249"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/categories?post=249"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/tags?post=249"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}