This is a deprecated alias for each_byte
.
Returns a random binary string containing size
bytes.
random_string = Random.new.bytes(10) # => "\xD7:R\xAB?\x83\xCE\xFAkO" random_string.size # => 10
Creates a new Socket::Option
object which contains a byte as data.
p Socket::Option.byte(:INET, :SOCKET, :KEEPALIVE, 1) #=> #<Socket::Option: INET SOCKET KEEPALIVE 1>
Returns the data in sockopt as an byte.
sockopt = Socket::Option.byte(:INET, :SOCKET, :KEEPALIVE, 1) p sockopt.byte => 1
See Zlib::GzipReader
documentation for a description.
This is a deprecated alias for each_byte
.
Returns the total size in bytes of all the messages on the POP server.
This doesn’t yet handle encodings
True if version
satisfies this Requirement
.
Returns the discarded bytes when Encoding::InvalidByteSequenceError
occurs.
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1") begin ec.convert("abc\xA1\xFFdef") rescue Encoding::InvalidByteSequenceError p $! #=> #<Encoding::InvalidByteSequenceError: "\xA1" followed by "\xFF" on EUC-JP> puts $!.error_bytes.dump #=> "\xA1" puts $!.readagain_bytes.dump #=> "\xFF" end
Returns the bytes to be read again when Encoding::InvalidByteSequenceError
occurs.
Calls the given block once for each byte in the stream.
Generates string
with length
number of cryptographically strong pseudo-random bytes.
OpenSSL::Random.random_bytes(12) #=> "..."
Generates string
with length
number of pseudo-random bytes.
Pseudo-random byte sequences generated by ::pseudo_bytes
will be unique if they are of sufficient length, but are not necessarily unpredictable.
OpenSSL::Random.pseudo_bytes(12) #=> "..."
Queries the entropy gathering daemon EGD on socket path given by filename
.
Fetches length
number of bytes and uses ::add to seed the OpenSSL
built-in PRNG.
SecureRandom.random_bytes generates a random binary string.
The argument n specifies the length of the result string.
If n is not specified or is nil, 16 is assumed. It may be larger in future.
The result may contain any byte: “x00” - “xff”.
p SecureRandom.random_bytes #=> "\xD8\\\xE0\xF4\r\xB2\xFC*WM\xFF\x83\x18\xF45\xB6" p SecureRandom.random_bytes #=> "m\xDC\xFC/\a\x00Uf\xB2\xB2P\xBD\xFF6S\x97"
If a secure random number generator is not available, NotImplementedError
is raised.
Number of bytes read out of the tar entry
Determines whether the given ‘requirement` is satisfied by the given `spec`, in the context of the current `activated` dependency graph.
@param [Object] requirement @param [DependencyGraph] activated the current dependency graph in the
resolution process.
@param [Object] spec @return [Boolean] whether ‘requirement` is satisfied by `spec` in the
context of the current `activated` dependency graph.