ライブラリ
クラス
-
ARGF
. class (7) -
Encoding
:: Converter (55) -
Encoding
:: InvalidByteSequenceError (77) -
Gem
:: Package :: TarReader :: Entry (11) - IO (7)
-
Net
:: POP3 (33) -
OpenSSL
:: BN (11) - Random (11)
- String (171)
- StringIO (28)
- StringScanner (22)
-
WIN32OLE
_ VARIANT (11)
モジュール
-
Net
:: HTTPHeader (33)
キーワード
- byterindex (2)
-
bytes
_ read (11) - bytesize (11)
- byteslice (33)
- bytesplice (4)
-
content
_ range (11) -
destination
_ encoding (11) -
destination
_ encoding _ name (11) -
each
_ byte (36) -
error
_ bytes (11) - getbyte (11)
-
incomplete
_ input? (11) -
n
_ bytes (11) -
n
_ mails (11) -
num
_ bytes (11) - peek (11)
- peep (11)
-
primitive
_ convert (22) -
primitive
_ errinfo (11) - putback (22)
- range (11)
-
range
_ length (11) -
readagain
_ bytes (11) - scrub (33)
- scrub! (33)
-
set
_ debug _ output (11) -
source
_ encoding (11) -
source
_ encoding _ name (11) - vartype (11)
検索結果
先頭5件
-
Gem
:: Package :: TarReader :: Entry # bytes _ read -> Integer (9202.0) -
自身から読み込んだバイト数を返します。
自身から読み込んだバイト数を返します。 -
String
# bytesize -> Integer (9201.0) -
文字列のバイト長を整数で返します。
...文字列のバイト長を整数で返します。
//emlist[例][ruby]{
#coding:UTF-8
# 実行結果は文字コードによって異なります。
p "いろは".size #=> 3
p "いろは".bytesize #=> 9
//}
@see String#size... -
String
# byteslice(nth) -> String | nil (9201.0) -
nth バイト目の文字を返します。nth が負の場合は文字列の末尾から数えます。 引数が範囲外を指定した場合は nil を返します。
...
nth バイト目の文字を返します。nth が負の場合は文字列の末尾から数えます。
引数が範囲外を指定した場合は nil を返します。
@param nth 文字の位置を表す整数を指定します。
@return 切り出した文字列を返します。戻り値の......文字エンコーディングは自身
と同じです。
//emlist[例][ruby]{
"hello".byteslice(1) # => "e"
"hello".byteslice(-1) # => "o"
"\u3042".byteslice(0) # => "\xE3"
"\u3042".byteslice(1) # => "\x81"
//}
@see String#slice... -
String
# byteslice(nth , len=1) -> String | nil (9201.0) -
nth バイト目から長さ len バイトの部分文字列を新しく作って返します。 nth が負の場合は文字列の末尾から数えます。引数が範囲外を指定した場合は nil を返します。
...
nth バイト目から長さ len バイトの部分文字列を新しく作って返します。
nth が負の場合は文字列の末尾から数えます。引数が範囲外を指定した場合は
nil を返します。
@param nth 取得したい文字列の開始バイトを整数で指定し......len 取得したい文字列の長さを正の整数で指定します。
@return 切り出した文字列を返します。戻り値の文字エンコーディングは自身
と同じです。
//emlist[例][ruby]{
"hello".byteslice(1, 2) # => "el"
"\u3042\u3044\u3046".bytesl......ice(0, 3) # => "\u3042"
//}
@see String#slice......ice(0, 3) # => "\u3042"
//}
@see String#slice
@see String#bytesplice... -
String
# bytesplice(index , length , str) -> String (9201.0) -
self の一部または全部を str で置き換えて str を返します。
...以外は
String#byteslice と同じです。
置き換え後の文字列の長さが対象の長さと違う場合、
適切に長さが調整されます。
@param index 置換したい文字列の範囲の始端
@param length 置換したい文字列の範囲の長さ
@param range 置換した......い文字列の範囲を示す Range オブジェクト
@raise IndexError index や length が範囲外の場合に発生
@raise RangeError range が範囲外の場合に発生
@raise IndexError 指定した始端や終端が文字列の境界と一致しない場合に発生
@see String#byteslice... -
Net
:: HTTPHeader # range -> Range|nil (6207.0) -
Range: ヘッダの示す範囲を Range オブジェクトで返します。
...Range: ヘッダの示す範囲を Range オブジェクトで返します。
ヘッダにない場合は nil を返します。
@raise Net::HTTPHeaderSyntaxError Range:ヘッダの中身が規格通り
でない場合に発生します。
//emlist[例 正常な......uire 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req['range'] = "bytes=1-5"
req.range # => [1..5]
//}
//emlist[例 Net::HTTPHeaderSyntaxError][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HT......TP::Get.new(uri.request_uri)
req['range'] = "invalid"
req.range # => Net::HTTPHeaderSyntaxError
//}... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize) -> Symbol (6201.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytes......ram options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol
options には以下が指定できます。
: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversion after o......input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Converter::AFTER_OUTPUT
戻り値は以下のうちのどれかです。
* :invalid_byte_sequence
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buffer_empty
* :fin... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize , options) -> Symbol (6201.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytes......ram options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol
options には以下が指定できます。
: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversion after o......input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Converter::AFTER_OUTPUT
戻り値は以下のうちのどれかです。
* :invalid_byte_sequence
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buffer_empty
* :fin... -
String
# byterindex(pattern , offset = self . bytesize) -> Integer | nil (6201.0) -
文字列のバイト単位のインデックス offset から左に向かって pattern を探索します。 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。
...ンデックス offset から左に向かって pattern を探索します。
最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。
見つからなければ nil を返します。
引数 pattern は探索する部分文字列または正規表現......で指定します。
offset が負の場合は、文字列の末尾から数えた位置から探索します。
byterindex と String#byteindex とでは、探索方向だけが逆になります。
完全に左右が反転した動作をするわけではありません。
探索はその開始......[String#byteindex の場合][ruby]{
p "stringstring".byteindex("ing", 1) # => 3
# ing # ここから探索を始める
# ing
# ing # 右にずらしていってここで見つかる
//}
//emlist[String#byterindex の場合][ruby]{
p "stringstring".byterindex("ing", -... -
Encoding
:: Converter # primitive _ errinfo -> Array (6131.0) -
直前の Encoding::Converter#primitive_convert による変換の結果を保持する五要素の配列を返します。
...Encoding::Converter#primitive_convert による変換の結果を保持する五要素の配列を返します。
@return [result, enc1, enc2, error_bytes, readagain_bytes] という五要素の配列
result は直前の primitive_convert の戻り値です。
それ以外の四要素は :invalid......_byte_sequence か :incomplete_input か :undefined_conversion だった場合に意味を持ちます。
enc1 はエラーの発生した原始変換の変換元のエンコーディング、enc2 は変換先のエンコーディングです。
error_bytes はエラーの発生原因となったバ......イト列、readagain_bytes は先読みによって変換器内部に保持されているバイト列です。
primitive_errinfo はもっぱら Encoding::Converter#primitive_convert と組み合わせて使います。Encoding::Converter#convert を用いている場合にも取得すること... -
Net
:: POP3 # n _ mails -> Integer (6114.0) -
サーバにあるメールの数を返します。
...にあるメールの数を返します。
@see Net::POP3#n_bytes
@raise TimeoutError 接続がタイムアウトした場合に発生します
@raise Net::POPError サーバがエラーを報告した場合に発生します
@raise Net::POPBadResponse サーバからの応答がプロトコル上... -
StringIO
# each _ byte -> Enumerator (6103.0) -
自身から 1 バイトずつ読み込み、整数 ch に変換し、それを引数として与えられたブロックを実行します。
...変換し、それを引数として与えられたブロックを実行します。
@raise IOError 自身が読み取り不可なら発生します。
//emlist[例][ruby]{
require "stringio"
a = StringIO.new("hoge")
a.each_byte{|ch| p ch }
#=> 104
# 111
# 103
# 101
//}
@see IO#each_byte...