forked from KOBA789/node.js_ja
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathstring_decoder.html
More file actions
161 lines (144 loc) · 6.78 KB
/
Copy pathstring_decoder.html
File metadata and controls
161 lines (144 loc) · 6.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!doctype html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>StringDecoder Node.js v0.11.11 Manual & Documentation</title>
<link rel="stylesheet" href="assets/style.css">
<link rel="stylesheet" href="assets/sh.css">
<link rel="canonical" href="http://nodejs.org/api/string_decoder.html">
</head>
<body class="alt apidoc" id="api-section-string_decoder">
<div id="intro" class="interior">
<a href="/" title="Go back to the home page">
<img id="logo" src="http://nodejs.org/images/logo-light.png" alt="node.js">
</a>
</div>
<div id="content" class="clearfix">
<div id="column2" class="interior">
<ul>
<!--
<li><a href="/" class="home">Home</a></li>
<li><a href="/download/" class="download">Download</a></li>
<li><a href="/about/" class="about">About</a></li>
<li><a href="http://npmjs.org/" class="npm">npm Registry</a></li>
<li><a href="http://nodejs.org/api/" class="docs current">Docs</a></li>
<li><a href="http://blog.nodejs.org" class="blog">Blog</a></li>
<li><a href="/community/" class="community">Community</a></li>
<li><a href="/logos/" class="logos">Logos</a></li>
-->
<li><a href="../" class="home">ホーム</a></li>
<li><a href="../#download" class="download">ダウンロード</a></li>
<li><a href="../about/" class="about">概要</a></li>
<li><a href="http://npmjs.org/" class="npm">npm レジストリ</a></li>
<li><a href="../api/" class="docs current">ドキュメント</a></li>
<li><a href="http://blog.nodejs.org" class="blog">ブログ</a></li>
<li><a href="../community/" class="community">コミュニティ</a></li>
<li><a href="../logos/" class="logos">ロゴ</a></li>
<li><a href="http://jobs.nodejs.org/" class="jobs">Jobs</a></li>
</ul>
<p class="twitter"><a href="http://twitter.com/nodejs">@nodejs</a></p>
</div>
<div id="column1" class="interior">
<header>
<h1>Node.js v0.11.11 マニュアル & ドキュメンテーション</h1>
<div id="gtoc">
<p>
<a href="index.html" name="toc">Index</a> |
<a href="all.html">View on single page</a> |
<a href="string_decoder.json">View as JSON</a>
</p>
</div>
<hr>
</header>
<div id="toc">
<h2>Table of Contents</h2>
<ul>
<li><a href="#string_decoder_stringdecoder">StringDecoder</a><ul>
<li><a href="#string_decoder_class_stringdecoder">Class: StringDecoder</a><ul>
<li><a href="#string_decoder_decoder_write_buffer">decoder.write(buffer)</a></li>
<li><a href="#string_decoder_decoder_end">decoder.end()</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div id="apicontent">
<h1>StringDecoder<span><a class="mark" href="#string_decoder_stringdecoder" id="string_decoder_stringdecoder">#</a></span></h1>
<pre class="api_stability_3">Stability: 3 - Stable</pre><!--
To use this module, do `require('string_decoder')`. StringDecoder decodes a
buffer to a string. It is a simple interface to `buffer.toString()` but provides
additional support for utf8.
-->
<p>このモジュールを使用するには <code>require('string_decoder')</code> をします。
StringDecoder はバッファから文字列にデコードします。
これは単純なインターフェース <code>buffer.toString()</code> ですが、
UTF-8 を特別にサポートします。
</p>
<pre><code>var StringDecoder = require('string_decoder').StringDecoder;
var decoder = new StringDecoder('utf8');
var cent = new Buffer([0xC2, 0xA2]);
console.log(decoder.write(cent));
var euro = new Buffer([0xE2, 0x82, 0xAC]);
console.log(decoder.write(euro));</code></pre>
<h2>Class: StringDecoder<span><a class="mark" href="#string_decoder_class_stringdecoder" id="string_decoder_class_stringdecoder">#</a></span></h2>
<!--
Accepts a single argument, `encoding` which defaults to `utf8`.
-->
<p>文字列の引数 <code>encoding</code> を受け取ります。デフォルトは <code>'utf8'</code> です。
</p>
<h3>decoder.write(buffer)<span><a class="mark" href="#string_decoder_decoder_write_buffer" id="string_decoder_decoder_write_buffer">#</a></span></h3>
<!--
Returns a decoded string.
-->
<p>デコードされた文字列を返します。
</p>
<h3>decoder.end()<span><a class="mark" href="#string_decoder_decoder_end" id="string_decoder_decoder_end">#</a></span></h3>
<!--
Returns any trailing bytes that were left in the buffer.
-->
<p>バッファに残った終端のバイト列を返します。
</p>
</div>
</div>
</div>
<div id="footer">
<a href="http://joyent.com" class="joyent-logo">Joyent</a>
<ul class="clearfix">
<!--
<li><a href="/">Node.js</a></li>
<li><a href="/download/">Download</a></li>
<li><a href="/about/">About</a></li>
<li><a href="http://npmjs.org/">npm Registry</a></li>
<li><a href="http://nodejs.org/api/">Docs</a></li>
<li><a href="http://blog.nodejs.org">Blog</a></li>
<li><a href="/community/">Community</a></li>
<li><a href="/logos/">Logos</a></li>
-->
<li><a href="../">Node.js</a></li>
<li><a href="../#download">ダウンロード</a></li>
<li><a href="../about/">概要</a></li>
<li><a href="http://npmjs.org/">npm レジストリ</a></li>
<li><a href="../api/">ドキュメント</a></li>
<li><a href="http://blog.nodejs.org">ブログ</a></li>
<li><a href="../community/">コミュニティ</a></li>
<li><a href="../logos/">ロゴ</a></li>
<li><a href="http://jobs.nodejs.org/">Jobs</a></li>
<li><a href="http://twitter.com/nodejs" class="twitter">@nodejs</a></li>
</ul>
<p>Copyright <a href="http://joyent.com/">Joyent, Inc</a>, Node.js is a <a href="/trademark-policy.pdf">trademark</a> of Joyent, Inc. View <a href="https://raw.github.com/joyent/node/v0.11.11/LICENSE">license</a>.</p>
</div>
<script src="../sh_main.js"></script>
<script src="../sh_javascript.min.js"></script>
<script>highlight(undefined, undefined, 'pre');</script>
<script>
window._gaq = [['_setAccount', 'UA-10874194-2'], ['_trackPageview']];
(function(d, t) {
var g = d.createElement(t),
s = d.getElementsByTagName(t)[0];
g.src = '//www.google-analytics.com/ga.js';
s.parentNode.insertBefore(g, s);
}(document, 'script'));
</script>
</body>
</html>