Linux server1.dn-server.com 4.18.0-553.89.1.lve.el8.x86_64 #1 SMP Wed Dec 10 13:58:50 UTC 2025 x86_64
LiteSpeed
Server IP : 195.201.204.189 & Your IP : 216.73.217.103
Domains :
Cant Read [ /etc/named.conf ]
User : beriska1
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
opt /
alt /
ruby33 /
share /
ri /
system /
IO /
Delete
Unzip
Name
Size
Permission
Date
Action
Buffer
[ DIR ]
drwxr-xr-x
2026-05-05 23:08
ConsoleMode
[ DIR ]
drwxr-xr-x
2026-05-05 23:08
EAGAINWaitReadable
[ DIR ]
drwxr-xr-x
2026-05-05 23:08
EAGAINWaitWritable
[ DIR ]
drwxr-xr-x
2026-05-05 23:08
EINPROGRESSWaitReadable
[ DIR ]
drwxr-xr-x
2026-05-05 23:08
EINPROGRESSWaitWritable
[ DIR ]
drwxr-xr-x
2026-05-05 23:08
EWOULDBLOCKWaitReadable
[ DIR ]
drwxr-xr-x
2026-05-05 23:08
EWOULDBLOCKWaitWritable
[ DIR ]
drwxr-xr-x
2026-05-05 23:08
TimeoutError
[ DIR ]
drwxr-xr-x
2026-05-05 23:08
WaitReadable
[ DIR ]
drwxr-xr-x
2026-05-05 23:08
WaitWritable
[ DIR ]
drwxr-xr-x
2026-05-05 23:08
generic_readable
[ DIR ]
drwxr-xr-x
2026-05-05 23:08
generic_writable
[ DIR ]
drwxr-xr-x
2026-05-05 23:08
%3c%3c-i.ri
727
B
-rw-r--r--
2026-04-07 17:22
advise-i.ri
1.82
KB
-rw-r--r--
2026-04-07 17:22
autoclose%3d-i.ri
648
B
-rw-r--r--
2026-04-07 17:22
autoclose%3f-i.ri
436
B
-rw-r--r--
2026-04-07 17:22
beep-i.ri
226
B
-rw-r--r--
2026-04-07 17:22
binmode%3f-i.ri
399
B
-rw-r--r--
2026-04-07 17:22
binmode-i.ri
462
B
-rw-r--r--
2026-04-07 17:22
binread-c.ri
694
B
-rw-r--r--
2026-04-07 17:22
binwrite-c.ri
671
B
-rw-r--r--
2026-04-07 17:22
cdesc-IO.ri
30.43
KB
-rw-r--r--
2026-04-07 17:22
check_winsize_changed-i.ri
260
B
-rw-r--r--
2026-04-07 17:22
clear_screen-i.ri
242
B
-rw-r--r--
2026-04-07 17:22
close-i.ri
1.04
KB
-rw-r--r--
2026-04-07 17:22
close_on_exec%3d-i.ri
1.01
KB
-rw-r--r--
2026-04-07 17:22
close_on_exec%3f-i.ri
584
B
-rw-r--r--
2026-04-07 17:22
close_read-i.ri
1023
B
-rw-r--r--
2026-04-07 17:22
close_write-i.ri
1.06
KB
-rw-r--r--
2026-04-07 17:22
closed%3f-i.ri
837
B
-rw-r--r--
2026-04-07 17:22
console-c.ri
637
B
-rw-r--r--
2026-04-07 17:22
console_mode%3d-i.ri
436
B
-rw-r--r--
2026-04-07 17:22
console_mode-i.ri
458
B
-rw-r--r--
2026-04-07 17:22
cooked%21-i.ri
476
B
-rw-r--r--
2026-04-07 17:22
cooked-i.ri
561
B
-rw-r--r--
2026-04-07 17:22
copy_stream-c.ri
2.28
KB
-rw-r--r--
2026-04-07 17:22
cursor%3d-i.ri
234
B
-rw-r--r--
2026-04-07 17:22
cursor-i.ri
545
B
-rw-r--r--
2026-04-07 17:22
cursor_down-i.ri
242
B
-rw-r--r--
2026-04-07 17:22
cursor_left-i.ri
242
B
-rw-r--r--
2026-04-07 17:22
cursor_right-i.ri
244
B
-rw-r--r--
2026-04-07 17:22
cursor_up-i.ri
238
B
-rw-r--r--
2026-04-07 17:22
each-i.ri
3.13
KB
-rw-r--r--
2026-04-07 17:22
each_byte-i.ri
778
B
-rw-r--r--
2026-04-07 17:22
each_char-i.ri
766
B
-rw-r--r--
2026-04-07 17:22
each_codepoint-i.ri
729
B
-rw-r--r--
2026-04-07 17:22
each_line-i.ri
2.9
KB
-rw-r--r--
2026-04-07 17:22
echo%3d-i.ri
509
B
-rw-r--r--
2026-04-07 17:22
echo%3f-i.ri
434
B
-rw-r--r--
2026-04-07 17:22
eof%3f-i.ri
1.34
KB
-rw-r--r--
2026-04-07 17:22
eof-i.ri
1.36
KB
-rw-r--r--
2026-04-07 17:22
erase_line-i.ri
240
B
-rw-r--r--
2026-04-07 17:22
erase_screen-i.ri
244
B
-rw-r--r--
2026-04-07 17:22
expect-i.ri
1.74
KB
-rw-r--r--
2026-04-07 17:22
external_encoding-i.ri
544
B
-rw-r--r--
2026-04-07 17:22
fcntl-i.ri
835
B
-rw-r--r--
2026-04-07 17:22
fdatasync-i.ri
498
B
-rw-r--r--
2026-04-07 17:22
fileno-i.ri
580
B
-rw-r--r--
2026-04-07 17:22
flush-i.ri
572
B
-rw-r--r--
2026-04-07 17:22
for_fd-c.ri
319
B
-rw-r--r--
2026-04-07 17:22
foreach-c.ri
2.95
KB
-rw-r--r--
2026-04-07 17:22
fsync-i.ri
934
B
-rw-r--r--
2026-04-07 17:22
getbyte-i.ri
706
B
-rw-r--r--
2026-04-07 17:22
getc-i.ri
710
B
-rw-r--r--
2026-04-07 17:22
getch-i.ri
517
B
-rw-r--r--
2026-04-07 17:22
getpass-i.ri
798
B
-rw-r--r--
2026-04-07 17:22
gets-i.ri
2.84
KB
-rw-r--r--
2026-04-07 17:22
goto-i.ri
232
B
-rw-r--r--
2026-04-07 17:22
goto_column-i.ri
242
B
-rw-r--r--
2026-04-07 17:22
iflush-i.ri
406
B
-rw-r--r--
2026-04-07 17:22
inspect-i.ri
465
B
-rw-r--r--
2026-04-07 17:22
internal_encoding-i.ri
538
B
-rw-r--r--
2026-04-07 17:22
ioctl-i.ri
838
B
-rw-r--r--
2026-04-07 17:22
ioflush-i.ri
421
B
-rw-r--r--
2026-04-07 17:22
isatty-i.ri
584
B
-rw-r--r--
2026-04-07 17:22
lineno%3d-i.ri
385
B
-rw-r--r--
2026-04-07 17:22
lineno-i.ri
370
B
-rw-r--r--
2026-04-07 17:22
new-c.ri
1.73
KB
-rw-r--r--
2026-04-07 17:22
noecho-i.ri
553
B
-rw-r--r--
2026-04-07 17:22
nonblock%3d-i.ri
2.06
KB
-rw-r--r--
2026-04-07 17:22
nonblock%3f-i.ri
361
B
-rw-r--r--
2026-04-07 17:22
nonblock-i.ri
572
B
-rw-r--r--
2026-04-07 17:22
nread-i.ri
477
B
-rw-r--r--
2026-04-07 17:22
oflush-i.ri
407
B
-rw-r--r--
2026-04-07 17:22
open-c.ri
618
B
-rw-r--r--
2026-04-07 17:22
path-i.ri
624
B
-rw-r--r--
2026-04-07 17:22
pathconf-i.ri
730
B
-rw-r--r--
2026-04-07 17:22
pid-i.ri
784
B
-rw-r--r--
2026-04-07 17:22
pipe-c.ri
3.17
KB
-rw-r--r--
2026-04-07 17:22
popen-c.ri
5.73
KB
-rw-r--r--
2026-04-07 17:22
pos%3d-i.ri
607
B
-rw-r--r--
2026-04-07 17:22
pos-i.ri
583
B
-rw-r--r--
2026-04-07 17:22
pread-i.ri
1.34
KB
-rw-r--r--
2026-04-07 17:22
pressed%3f-i.ri
236
B
-rw-r--r--
2026-04-07 17:22
print-i.ri
1.8
KB
-rw-r--r--
2026-04-07 17:22
printf-i.ri
487
B
-rw-r--r--
2026-04-07 17:22
putc-i.ri
735
B
-rw-r--r--
2026-04-07 17:22
puts-i.ri
1.87
KB
-rw-r--r--
2026-04-07 17:22
pwrite-i.ri
1.17
KB
-rw-r--r--
2026-04-07 17:22
raw%21-i.ri
593
B
-rw-r--r--
2026-04-07 17:22
raw-i.ri
1.08
KB
-rw-r--r--
2026-04-07 17:22
read-c.ri
2.02
KB
-rw-r--r--
2026-04-07 17:22
read-i.ri
3.07
KB
-rw-r--r--
2026-04-07 17:22
read_nonblock-i.ri
2.78
KB
-rw-r--r--
2026-04-07 17:22
readbyte-i.ri
710
B
-rw-r--r--
2026-04-07 17:22
readchar-i.ri
723
B
-rw-r--r--
2026-04-07 17:22
readline-i.ri
643
B
-rw-r--r--
2026-04-07 17:22
readlines-c.ri
2.62
KB
-rw-r--r--
2026-04-07 17:22
readlines-i.ri
2.55
KB
-rw-r--r--
2026-04-07 17:22
readpartial-i.ri
4.4
KB
-rw-r--r--
2026-04-07 17:22
ready%3f-i.ri
469
B
-rw-r--r--
2026-04-07 17:22
reopen-i.ri
1.33
KB
-rw-r--r--
2026-04-07 17:22
rewind-i.ri
887
B
-rw-r--r--
2026-04-07 17:22
scroll_backward-i.ri
250
B
-rw-r--r--
2026-04-07 17:22
scroll_forward-i.ri
248
B
-rw-r--r--
2026-04-07 17:22
seek-i.ri
1.7
KB
-rw-r--r--
2026-04-07 17:22
select-c.ri
6.03
KB
-rw-r--r--
2026-04-07 17:22
set_encoding-i.ri
1.37
KB
-rw-r--r--
2026-04-07 17:22
set_encoding_by_bom-i.ri
1017
B
-rw-r--r--
2026-04-07 17:22
stat-i.ri
595
B
-rw-r--r--
2026-04-07 17:22
sync%3d-i.ri
943
B
-rw-r--r--
2026-04-07 17:22
sync-i.ri
666
B
-rw-r--r--
2026-04-07 17:22
sysopen-c.ri
794
B
-rw-r--r--
2026-04-07 17:22
sysread-i.ri
525
B
-rw-r--r--
2026-04-07 17:22
sysseek-i.ri
565
B
-rw-r--r--
2026-04-07 17:22
syswrite-i.ri
766
B
-rw-r--r--
2026-04-07 17:22
tell-i.ri
606
B
-rw-r--r--
2026-04-07 17:22
timeout%3d-i.ri
1.18
KB
-rw-r--r--
2026-04-07 17:22
timeout-i.ri
342
B
-rw-r--r--
2026-04-07 17:22
to_i-i.ri
554
B
-rw-r--r--
2026-04-07 17:22
to_io-i.ri
281
B
-rw-r--r--
2026-04-07 17:22
to_path-i.ri
599
B
-rw-r--r--
2026-04-07 17:22
try_convert-c.ri
653
B
-rw-r--r--
2026-04-07 17:22
tty%3f-i.ri
552
B
-rw-r--r--
2026-04-07 17:22
ungetbyte-i.ri
1.46
KB
-rw-r--r--
2026-04-07 17:22
ungetc-i.ri
1.57
KB
-rw-r--r--
2026-04-07 17:22
wait-i.ri
920
B
-rw-r--r--
2026-04-07 17:22
wait_priority-i.ri
692
B
-rw-r--r--
2026-04-07 17:22
wait_readable-i.ri
659
B
-rw-r--r--
2026-04-07 17:22
wait_writable-i.ri
582
B
-rw-r--r--
2026-04-07 17:22
winsize%3d-i.ri
498
B
-rw-r--r--
2026-04-07 17:22
winsize-i.ri
422
B
-rw-r--r--
2026-04-07 17:22
write-c.ri
1.97
KB
-rw-r--r--
2026-04-07 17:22
write-i.ri
840
B
-rw-r--r--
2026-04-07 17:22
write_nonblock-i.ri
2.55
KB
-rw-r--r--
2026-04-07 17:22
Save
Rename
U:RDoc::NormalClass[iI"IO:ET@I"Object;To:RDoc::Markup::Document:@parts[ o;;[ : @fileI"ext/io/console/console.c;T:0@omit_headings_from_table_of_contents_below0o;;[ ; I"ext/pty/lib/expect.rb;T; 0o;;[�o:RDoc::Markup::Paragraph;[I";An instance of class \IO (commonly called a _stream_) ;TI"Krepresents an input/output stream in the underlying operating system. ;TI":\Class \IO is the basis for input and output in Ruby.;To:RDoc::Markup::BlankLine o;;[I"O\Class File is the only class in the Ruby core that is a subclass of \IO. ;TI"KSome classes in the Ruby standard library are also subclasses of \IO; ;TI"+these include TCPSocket and UDPSocket.;T@o;;[ I"?The global constant ARGF (also accessible as <tt>$<</tt>) ;TI"Eprovides an IO-like stream that allows access to all file paths ;TI"9found in ARGV (or found in STDIN if ARGV is empty). ;TI"*ARGF is not itself a subclass of \IO.;T@o;;[I"G\Class StringIO provides an IO-like stream that handles a String. ;TI".StringIO is not itself a subclass of \IO.;T@o;;[I",Important objects based on \IO include:;T@o:RDoc::Markup::List: @type:BULLET:@items[ o:RDoc::Markup::ListItem:@label0;[o;;[I"$stdin.;To;;0;[o;;[I" $stdout.;To;;0;[o;;[I" $stderr.;To;;0;[o;;[I"Instances of class File.;T@o;;[I"-An instance of \IO may be created using:;T@o; ;;;[ o;;0;[o;;[I"LIO.new: returns a new \IO object for the given integer file descriptor.;To;;0;[o;;[I"9IO.open: passes a new \IO object to the given block.;To;;0;[o;;[I"TIO.popen: returns a new \IO object that is connected to the $stdin and $stdout ;TI"$of a newly-launched subprocess.;To;;0;[o;;[I"HKernel#open: Returns a new \IO object connected to a given source: ;TI"!stream, file, or subprocess.;T@o;;[I"+Like a File stream, an \IO stream has:;T@o; ;;;[o;;0;[o;;[I"KA read/write mode, which may be read-only, write-only, or read/write; ;TI"<see {Read/Write Mode}[rdoc-ref:File@Read-2FWrite+Mode].;To;;0;[o;;[I"4A data mode, which may be text-only or binary; ;TI".see {Data Mode}[rdoc-ref:File@Data+Mode].;To;;0;[o;;[I"&Internal and external encodings; ;TI".see {Encodings}[rdoc-ref:File@Encodings].;T@o;;[I"(And like other \IO streams, it has:;T@o; ;;;[o;;0;[o;;[I"?A position, which determines where in the stream the next ;TI" read or write is to occur; ;TI"*see {Position}[rdoc-ref:IO@Position].;To;;0;[o;;[I"BA line number, which is a special, line-oriented, "position" ;TI"4(different from the position mentioned above); ;TI"0see {Line Number}[rdoc-ref:IO@Line+Number].;T@S:RDoc::Markup::Heading: leveli: textI""Extension <tt>io/console</tt>;T@o;;[I"=Extension <tt>io/console</tt> provides numerous methods ;TI"'for interacting with the console; ;TI"5requiring it adds numerous methods to class \IO.;T@S;;i;I"Example Files;T@o;;[I",Many examples here use these variables:;T@o:RDoc::Markup::Verbatim;[I"## English text with newlines. ;TI"text = <<~EOT ;TI" First line ;TI" Second line ;TI" ;TI" Fourth line ;TI" Fifth line ;TI" EOT ;TI" ;TI"# Russian text. ;TI"5russian = "\u{442 435 441 442}" # => "тест" ;TI" ;TI"# Binary data. ;TI"-data = "\u9990\u9991\u9992\u9993\u9994" ;TI" ;TI"# Text file. ;TI"File.write('t.txt', text) ;TI" ;TI"# File with Russian text. ;TI""File.write('t.rus', russian) ;TI" ;TI"# File with binary data. ;TI"(f = File.new('t.dat', 'wb:UTF-16') ;TI"f.write(data) ;TI" f.close ;T:@format0S;;i;I"Open Options;T@o;;[I"?A number of \IO methods accept optional keyword arguments ;TI"5that determine how a new stream is to be opened:;T@o; ;;;[o;;0;[o;;[I"+:mode+: Stream mode.;To;;0;[o;;[I"(+:flags+: Integer file open flags; ;TI"7If +mode+ is also given, the two are bitwise-ORed.;To;;0;[o;;[I"<+:external_encoding+: External encoding for the stream.;To;;0;[o;;[I"=+:internal_encoding+: Internal encoding for the stream. ;TI"B<tt>'-'</tt> is a synonym for the default internal encoding. ;TI"0If the value is +nil+ no conversion occurs.;To;;0;[o;;[I"X+:encoding+: Specifies external and internal encodings as <tt>'extern:intern'</tt>.;To;;0;[o;;[I"W+:textmode+: If a truthy value, specifies the mode as text-only, binary otherwise.;To;;0;[o;;[I"V+:binmode+: If a truthy value, specifies the mode as binary, text-only otherwise.;To;;0;[o;;[I"I+:autoclose+: If a truthy value, specifies that the +fd+ will close ;TI"7when the stream closes; otherwise it remains open.;To;;0;[o;;[I"X+:path:+ If a string value is provided, it is used in #inspect and is available as ;TI"#path method.;T@o;;[I">Also available are the options offered in String#encode, ;TI"Iwhich may control conversion between external and internal encoding.;T@S;;i;I"Basic \IO;T@o;;[I":You can perform basic stream \IO with these methods, ;TI"3which typically operate on multi-byte strings:;T@o; ;;;[o;;0;[o;;[I"SIO#read: Reads and returns some or all of the remaining bytes from the stream.;To;;0;[o;;[I":IO#write: Writes zero or more strings to the stream; ;TI"Leach given object that is not already a string is converted via +to_s+.;T@S;;i;I" Position;T@o;;[ I"9An \IO stream has a nonnegative integer _position_, ;TI"Kwhich is the byte offset at which the next read or write is to occur. ;TI"<A new stream has position zero (and line number zero); ;TI"Cmethod +rewind+ resets the position (and line number) to zero.;T@o;;[I"The relevant methods:;T@o; ;;;[ o;;0;[o;;[I"XIO#tell (aliased as +#pos+): Returns the current position (in bytes) in the stream.;To;;0;[o;;[I"[IO#pos=: Sets the position of the stream to a given integer +new_position+ (in bytes).;To;;0;[o;;[I"VIO#seek: Sets the position of the stream to a given integer +offset+ (in bytes), ;TI"+relative to a given position +whence+ ;TI":(indicating the beginning, end, or current position).;To;;0;[o;;[I"WIO#rewind: Positions the stream at the beginning (also resetting the line number).;T@S;;i;I"Open and Closed Streams;T@o;;[I"IA new \IO stream may be open for reading, open for writing, or both.;T@o;;[I"LA stream is automatically closed when claimed by the garbage collector.;T@o;;[I"IAttempted reading or writing on a closed stream raises an exception.;T@o;;[I"The relevant methods:;T@o; ;;;[ o;;0;[o;;[I">IO#close: Closes the stream for both reading and writing.;To;;0;[o;;[I"2IO#close_read: Closes the stream for reading.;To;;0;[o;;[I"3IO#close_write: Closes the stream for writing.;To;;0;[o;;[I"6IO#closed?: Returns whether the stream is closed.;T@S;;i;I"End-of-Stream;T@o;;[I"=You can query whether a stream is positioned at its end:;T@o; ;;;[o;;0;[o;;[I"VIO#eof? (also aliased as +#eof+): Returns whether the stream is at end-of-stream.;T@o;;[I"AYou can reposition to end-of-stream by using method IO#seek:;T@o;;[ I"f = File.new('t.txt') ;TI"f.eof? # => false ;TI"f.seek(0, :END) ;TI"f.eof? # => true ;TI" f.close ;T;0o;;[I"KOr by reading all stream content (which is slower than using IO#seek):;T@o;;[ I"f.rewind ;TI"f.eof? # => false ;TI"Hf.read # => "First line\nSecond line\n\nFourth line\nFifth line\n" ;TI"f.eof? # => true ;T;0S;;i;I" Line \IO;T@o;;[I"AYou can read an \IO stream line-by-line using these methods:;T@o; ;;;[ o;;0;[o;;[I"LIO#each_line: Reads each remaining line, passing it to the given block.;To;;0;[o;;[I"$IO#gets: Returns the next line.;To;;0;[o;;[I"GIO#readline: Like #gets, but raises an exception at end-of-stream.;To;;0;[o;;[I";IO#readlines: Returns all remaining lines in an array.;T@o;;[I"*Each of these reader methods accepts:;T@o; ;;;[o;;0;[o;;[I"(An optional line separator, +sep+; ;TI"6see {Line Separator}[rdoc-ref:IO@Line+Separator].;To;;0;[o;;[I"+An optional line-size limit, +limit+; ;TI".see {Line Limit}[rdoc-ref:IO@Line+Limit].;T@o;;[I"CFor each of these reader methods, reading may begin mid-line, ;TI")depending on the stream's position; ;TI"*see {Position}[rdoc-ref:IO@Position]:;T@o;;[ I"f = File.new('t.txt') ;TI"f.pos = 27 ;TI""f.each_line {|line| p line } ;TI" f.close ;T;0o;;[I"Output:;T@o;;[I""rth line\n" ;TI""Fifth line\n" ;T;0o;;[I"CYou can write to an \IO stream line-by-line using this method:;T@o; ;;;[o;;0;[o;;[I"+IO#puts: Writes objects to the stream.;T@S;;i;I"Line Separator;T@o;;[I"9Each of these methods uses a <i>line separator</i>, ;TI"-which is the string that delimits lines:;T@o; ;;;[o;;0;[o;;[I"IO.foreach.;To;;0;[o;;[I"IO.readlines.;To;;0;[o;;[I"IO#each_line.;To;;0;[o;;[I" IO#gets.;To;;0;[o;;[I"IO#readline.;To;;0;[o;;[I"IO#readlines.;T@o;;[ I"QThe default line separator is the given by the global variable <tt>$/</tt>, ;TI".whose value is by default <tt>"\n"</tt>. ;TI"DThe line to be read next is all data from the current position ;TI" to the next line separator:;T@o;;[I"f = File.new('t.txt') ;TI" f.gets # => "First line\n" ;TI"!f.gets # => "Second line\n" ;TI"f.gets # => "\n" ;TI"!f.gets # => "Fourth line\n" ;TI" f.gets # => "Fifth line\n" ;TI" f.close ;T;0o;;[I"0You can specify a different line separator:;T@o;;[I"f = File.new('t.txt') ;TI""f.gets('l') # => "First l" ;TI")f.gets('li') # => "ine\nSecond li" ;TI"+f.gets('lin') # => "ne\n\nFourth lin" ;TI"f.gets # => "e\n" ;TI" f.close ;T;0o;;[I"+There are two special line separators:;T@o; ;;;[o;;0;[o;;[I";+nil+: The entire stream is read into a single string:;T@o;;[I"f = File.new('t.txt') ;TI"Mf.gets(nil) # => "First line\nSecond line\n\nFourth line\nFifth line\n" ;TI" f.close ;T;0o;;0;[o;;[I"B<tt>''</tt> (the empty string): The next "paragraph" is read ;TI"E(paragraphs being separated by two consecutive line separators):;T@o;;[ I"f = File.new('t.txt') ;TI"3f.gets('') # => "First line\nSecond line\n\n" ;TI"1f.gets('') # => "Fourth line\nFifth line\n" ;TI" f.close ;T;0S;;i;I"Line Limit;T@o;;[I"5Each of these methods uses a <i>line limit</i>, ;TI"Pwhich specifies that the number of bytes returned may not be (much) longer ;TI"than the given +limit+;;T@o; ;;;[o;;0;[o;;[I"IO.foreach.;To;;0;[o;;[I"IO.readlines.;To;;0;[o;;[I"IO#each_line.;To;;0;[o;;[I" IO#gets.;To;;0;[o;;[I"IO#readline.;To;;0;[o;;[I"IO#readlines.;T@o;;[I"TA multi-byte character will not be split, and so a line may be slightly longer ;TI"than the given limit.;T@o;;[I"CIf +limit+ is not given, the line is determined only by +sep+.;T@o;;[I"$# Text with 1-byte characters. ;TI"3File.open('t.txt') {|f| f.gets(1) } # => "F" ;TI"4File.open('t.txt') {|f| f.gets(2) } # => "Fi" ;TI"5File.open('t.txt') {|f| f.gets(3) } # => "Fir" ;TI"6File.open('t.txt') {|f| f.gets(4) } # => "Firs" ;TI"# No more than one line. ;TI"<File.open('t.txt') {|f| f.gets(10) } # => "First line" ;TI">File.open('t.txt') {|f| f.gets(11) } # => "First line\n" ;TI">File.open('t.txt') {|f| f.gets(12) } # => "First line\n" ;TI" ;TI"=# Text with 2-byte characters, which will not be split. ;TI"5File.open('t.rus') {|f| f.gets(1).size } # => 1 ;TI"5File.open('t.rus') {|f| f.gets(2).size } # => 1 ;TI"5File.open('t.rus') {|f| f.gets(3).size } # => 2 ;TI"5File.open('t.rus') {|f| f.gets(4).size } # => 2 ;T;0S;;i;I""Line Separator and Line Limit;T@o;;[I"-With arguments +sep+ and +limit+ given, ;TI" combines the two behaviors:;T@o; ;;;[o;;0;[o;;[I"AReturns the next line as determined by line separator +sep+.;To;;0;[o;;[I"=But returns no more bytes than are allowed by the limit.;T@o;;[I" Example:;T@o;;[I"@File.open('t.txt') {|f| f.gets('li', 20) } # => "First li" ;TI":File.open('t.txt') {|f| f.gets('li', 2) } # => "Fi" ;T;0S;;i;I"Line Number;T@o;;[I"IA readable \IO stream has a non-negative integer <i>line number</i>.;T@o;;[I"The relevant methods:;T@o; ;;;[o;;0;[o;;[I"(IO#lineno: Returns the line number.;To;;0;[o;;[I"4IO#lineno=: Resets and returns the line number.;T@o;;[ I"5Unless modified by a call to method IO#lineno=, ;TI"1the line number is the number of lines read ;TI"'by certain line-oriented methods, ;TI"1according to the given line separator +sep+:;T@o; ;;;[ o;;0;[o;;[I"FIO.foreach: Increments the line number on each call to the block.;To;;0;[o;;[I"HIO#each_line: Increments the line number on each call to the block.;To;;0;[o;;[I")IO#gets: Increments the line number.;To;;0;[o;;[I"-IO#readline: Increments the line number.;To;;0;[o;;[I"AIO#readlines: Increments the line number for each line read.;T@o;;[I"IA new stream is initially has line number zero (and position zero); ;TI"Cmethod +rewind+ resets the line number (and position) to zero:;T@o;;[I"f = File.new('t.txt') ;TI"f.lineno # => 0 ;TI""f.gets # => "First line\n" ;TI"f.lineno # => 1 ;TI"f.rewind ;TI"f.lineno # => 0 ;TI" f.close ;T;0o;;[I"AReading lines from a stream usually changes its line number:;T@o;;[I" f = File.new('t.txt', 'r') ;TI"f.lineno # => 0 ;TI"+f.readline # => "This is line one.\n" ;TI"f.lineno # => 1 ;TI"2f.readline # => "This is the second line.\n" ;TI"f.lineno # => 2 ;TI"0f.readline # => "Here's the third line.\n" ;TI"f.lineno # => 3 ;TI"f.eof? # => true ;TI" f.close ;T;0o;;[I"FIterating over lines in a stream usually changes its line number:;T@o;;[ I"File.open('t.txt') do |f| ;TI" f.each_line do |line| ;TI"A p "position=#{f.pos} eof?=#{f.eof?} lineno=#{f.lineno}" ;TI" end ;TI" end ;T;0o;;[I"Output:;T@o;;[ I"'"position=11 eof?=false lineno=1" ;TI"'"position=23 eof?=false lineno=2" ;TI"'"position=24 eof?=false lineno=3" ;TI"'"position=36 eof?=false lineno=4" ;TI"&"position=47 eof?=true lineno=5" ;T;0o;;[I";Unlike the stream's {position}[rdoc-ref:IO@Position], ;TI"Mthe line number does not affect where the next read or write will occur:;T@o;;[I"f = File.new('t.txt') ;TI"f.lineno = 1000 ;TI"f.lineno # => 1000 ;TI""f.gets # => "First line\n" ;TI"f.lineno # => 1001 ;TI" f.close ;T;0o;;[I"HAssociated with the line number is the global variable <tt>$.</tt>:;T@o; ;;;[o;;0;[o;;[I"6When a stream is opened, <tt>$.</tt> is not set; ;TI"Bits value is left over from previous activity in the process:;T@o;;[ I" $. = 41 ;TI"f = File.new('t.txt') ;TI" $. = 41 ;TI" # => 41 ;TI" f.close ;T;0o;;0;[o;;[I"RWhen a stream is read, <tt>$.</tt> is set to the line number for that stream:;T@o;;[ I"f0 = File.new('t.txt') ;TI"f1 = File.new('t.dat') ;TI"`f0.readlines # => ["First line\n", "Second line\n", "\n", "Fourth line\n", "Fifth line\n"] ;TI"$. # => 5 ;TI"Lf1.readlines # => ["\xFE\xFF\x99\x90\x99\x91\x99\x92\x99\x93\x99\x94"] ;TI"$. # => 1 ;TI"f0.close ;TI"f1.close ;T;0o;;0;[o;;[I"=Methods IO#rewind and IO#seek do not affect <tt>$.</tt>:;T@o;;[I"f = File.new('t.txt') ;TI"_f.readlines # => ["First line\n", "Second line\n", "\n", "Fourth line\n", "Fifth line\n"] ;TI"$. # => 5 ;TI"f.rewind ;TI"f.seek(0, :SET) ;TI"$. # => 5 ;TI" f.close ;T;0S;;i;I"Character \IO;T@o;;[I"NYou can process an \IO stream character-by-character using these methods:;T@o; ;;;[ o;;0;[o;;[I"CIO#getc: Reads and returns the next character from the stream.;To;;0;[o;;[I"GIO#readchar: Like #getc, but raises an exception at end-of-stream.;To;;0;[o;;[I"PIO#ungetc: Pushes back ("unshifts") a character or integer onto the stream.;To;;0;[o;;[I"/IO#putc: Writes a character to the stream.;To;;0;[o;;[I"AIO#each_char: Reads each remaining character in the stream, ;TI".passing the character to the given block.;TS;;i;I" Byte \IO;T@o;;[I"DYou can process an \IO stream byte-by-byte using these methods:;T@o; ;;;[ o;;0;[o;;[I"KIO#getbyte: Returns the next 8-bit byte as an integer in range 0..255.;To;;0;[o;;[I"MIO#readbyte: Like #getbyte, but raises an exception if at end-of-stream.;To;;0;[o;;[I"HIO#ungetbyte: Pushes back ("unshifts") a byte back onto the stream.;To;;0;[o;;[I"<IO#each_byte: Reads each remaining byte in the stream, ;TI")passing the byte to the given block.;T@S;;i;I"Codepoint \IO;T@o;;[I":You can process an \IO stream codepoint-by-codepoint:;T@o; ;;;[o;;0;[o;;[I"VIO#each_codepoint: Reads each remaining codepoint, passing it to the given block.;T@S;;i;I"What's Here;T@o;;[I")First, what's elsewhere. \Class \IO:;T@o; ;;;[o;;0;[o;;[I"AInherits from {class Object}[rdoc-ref:Object@What-27s+Here].;To;;0;[o;;[I"FIncludes {module Enumerable}[rdoc-ref:Enumerable@What-27s+Here], ;TI"1which provides dozens of additional methods.;T@o;;[I":Here, class \IO provides methods that are useful for:;T@o; ;;;[o;;0;[o;;[I"%{Creating}[rdoc-ref:IO@Creating];To;;0;[o;;[I"#{Reading}[rdoc-ref:IO@Reading];To;;0;[o;;[I"#{Writing}[rdoc-ref:IO@Writing];To;;0;[o;;[I"+{Positioning}[rdoc-ref:IO@Positioning];To;;0;[o;;[I"'{Iterating}[rdoc-ref:IO@Iterating];To;;0;[o;;[I"%{Settings}[rdoc-ref:IO@Settings];To;;0;[o;;[I"%{Querying}[rdoc-ref:IO@Querying];To;;0;[o;;[I"'{Buffering}[rdoc-ref:IO@Buffering];To;;0;[o;;[I"5{Low-Level Access}[rdoc-ref:IO@Low-Level+Access];To;;0;[o;;[I"{Other}[rdoc-ref:IO@Other];T@S;;i;I" Creating;T@o; ;;;[ o;;0;[o;;[I"U::new (aliased as ::for_fd): Creates and returns a new \IO object for the given ;TI"integer file descriptor.;To;;0;[o;;[I"&::open: Creates a new \IO object.;To;;0;[o;;[I"G::pipe: Creates a connected pair of reader and writer \IO objects.;To;;0;[o;;[I"B::popen: Creates an \IO object to interact with a subprocess.;To;;0;[o;;[I"H::select: Selects which given \IO instances are ready for reading, ;TI")writing, or have pending exceptions.;T@S;;i;I"Reading;T@o; ;;;[o;;0;[o;;[I"F::binread: Returns a binary string with all or a subset of bytes ;TI"from the given file.;To;;0;[o;;[I"P::read: Returns a string with all or a subset of bytes from the given file.;To;;0;[o;;[I"W::readlines: Returns an array of strings, which are the lines from the given file.;To;;0;[o;;[I"J#getbyte: Returns the next 8-bit byte read from +self+ as an integer.;To;;0;[o;;[I"D#getc: Returns the next character read from +self+ as a string.;To;;0;[o;;[I".#gets: Returns the line read from +self+.;To;;0;[o;;[I"A#pread: Returns all or the next _n_ bytes read from +self+, ;TI"(not updating the receiver's offset.;To;;0;[o;;[I"I#read: Returns all remaining or the next _n_ bytes read from +self+ ;TI"for a given _n_.;To;;0;[o;;[I"J#read_nonblock: the next _n_ bytes read from +self+ for a given _n_, ;TI"in non-block mode.;To;;0;[o;;[I"8#readbyte: Returns the next byte read from +self+; ;TI"@same as #getbyte, but raises an exception on end-of-stream.;To;;0;[o;;[I"=#readchar: Returns the next character read from +self+; ;TI"=same as #getc, but raises an exception on end-of-stream.;To;;0;[o;;[I"8#readline: Returns the next line read from +self+; ;TI"@same as #getline, but raises an exception of end-of-stream.;To;;0;[o;;[I"E#readlines: Returns an array of all lines read read from +self+.;To;;0;[o;;[I"G#readpartial: Returns up to the given number of bytes from +self+.;T@S;;i;I"Writing;T@o; ;;;[o;;0;[o;;[I"L::binwrite: Writes the given string to the file at the given filepath, ;TI"in binary mode.;To;;0;[o;;[I"0::write: Writes the given string to +self+.;To;;0;[o;;[I"-#<<: Appends the given string to +self+.;To;;0;[o;;[I">#print: Prints last read line or given objects to +self+.;To;;0;[o;;[I"L#printf: Writes to +self+ based on the given format string and objects.;To;;0;[o;;[I")#putc: Writes a character to +self+.;To;;0;[o;;[I"I#puts: Writes lines to +self+, making sure line ends with a newline.;To;;0;[o;;[I";#pwrite: Writes the given string at the given offset, ;TI"(not updating the receiver's offset.;To;;0;[o;;[I"8#write: Writes one or more given strings to +self+.;To;;0;[o;;[I"V#write_nonblock: Writes one or more given strings to +self+ in non-blocking mode.;T@S;;i;I"Positioning;T@o; ;;;[o;;0;[o;;[I"8#lineno: Returns the current line number in +self+.;To;;0;[o;;[I".#lineno=: Sets the line number is +self+.;To;;0;[o;;[I"H#pos (aliased as #tell): Returns the current byte offset in +self+.;To;;0;[o;;[I"+#pos=: Sets the byte offset in +self+.;To;;0;[o;;[I"D#reopen: Reassociates +self+ with a new or existing \IO stream.;To;;0;[o;;[I"9#rewind: Positions +self+ to the beginning of input.;To;;0;[o;;[I"B#seek: Sets the offset for +self+ relative to given position.;T@S;;i;I"Iterating;T@o; ;;;[ o;;0;[o;;[I"<::foreach: Yields each line of given file to the block.;To;;0;[o;;[I":#each (aliased as #each_line): Calls the given block ;TI")with each successive line in +self+.;To;;0;[o;;[I"K#each_byte: Calls the given block with each successive byte in +self+ ;TI"as an integer.;To;;0;[o;;[I"P#each_char: Calls the given block with each successive character in +self+ ;TI"as a string.;To;;0;[o;;[I"U#each_codepoint: Calls the given block with each successive codepoint in +self+ ;TI"as an integer.;T@S;;i;I" Settings;T@o; ;;;[o;;0;[o;;[I"2#autoclose=: Sets whether +self+ auto-closes.;To;;0;[o;;[I"*#binmode: Sets +self+ to binary mode.;To;;0;[o;;[I"#close: Closes +self+.;To;;0;[o;;[I"2#close_on_exec=: Sets the close-on-exec flag.;To;;0;[o;;[I",#close_read: Closes +self+ for reading.;To;;0;[o;;[I"-#close_write: Closes +self+ for writing.;To;;0;[o;;[I"1#set_encoding: Sets the encoding for +self+.;To;;0;[o;;[I"F#set_encoding_by_bom: Sets the encoding for +self+, based on its ;TI"Unicode byte-order-mark.;To;;0;[o;;[I"3#sync=: Sets the sync-mode to the given value.;T@S;;i;I" Querying;T@o; ;;;[o;;0;[o;;[I"5#autoclose?: Returns whether +self+ auto-closes.;To;;0;[o;;[I"9#binmode?: Returns whether +self+ is in binary mode.;To;;0;[o;;[I"@#close_on_exec?: Returns the close-on-exec flag for +self+.;To;;0;[o;;[I"0#closed?: Returns whether +self+ is closed.;To;;0;[o;;[I"I#eof? (aliased as #eof): Returns whether +self+ is at end-of-stream.;To;;0;[o;;[I"I#external_encoding: Returns the external encoding object for +self+.;To;;0;[o;;[I"O#fileno (aliased as #to_i): Returns the integer file descriptor for +self+;To;;0;[o;;[I"I#internal_encoding: Returns the internal encoding object for +self+.;To;;0;[o;;[I"M#pid: Returns the process ID of a child process associated with +self+, ;TI"&if +self+ was created by ::popen.;To;;0;[o;;[I"S#stat: Returns the File::Stat object containing status information for +self+.;To;;0;[o;;[I"3#sync: Returns whether +self+ is in sync-mode.;To;;0;[o;;[I"F#tty? (aliased as #isatty): Returns whether +self+ is a terminal.;T@S;;i;I"Buffering;T@o; ;;;[ o;;0;[o;;[I"H#fdatasync: Immediately writes all buffered data in +self+ to disk.;To;;0;[o;;[I"G#flush: Flushes any buffered data within +self+ to the underlying ;TI"operating system.;To;;0;[o;;[I"S#fsync: Immediately writes all buffered data and attributes in +self+ to disk.;To;;0;[o;;[I"N#ungetbyte: Prepends buffer for +self+ with given integer byte or string.;To;;0;[o;;[I";#ungetc: Prepends buffer for +self+ with given string.;T@S;;i;I"Low-Level Access;T@o; ;;;[o;;0;[o;;[I"2::sysopen: Opens the file given by its path, ;TI"+returning the integer file descriptor.;To;;0;[o;;[I"S#advise: Announces the intention to access data from +self+ in a specific way.;To;;0;[o;;[I">#fcntl: Passes a low-level command to the file specified ;TI""by the given file descriptor.;To;;0;[o;;[I"@#ioctl: Passes a low-level command to the device specified ;TI""by the given file descriptor.;To;;0;[o;;[I"V#sysread: Returns up to the next _n_ bytes read from self using a low-level read.;To;;0;[o;;[I"*#sysseek: Sets the offset for +self+.;To;;0;[o;;[I"J#syswrite: Writes the given string to +self+ using a low-level write.;T@S;;i;I" Other;T@o; ;;;[o;;0;[o;;[I"@::copy_stream: Copies data from a source to a destination, ;TI"7each of which is a filepath or an \IO-like object.;To;;0;[o;;[I"G::try_convert: Returns a new \IO object resulting from converting ;TI"the given object.;To;;0;[o;;[I";#inspect: Returns the string representation of +self+.;T; I" io.c;T; 0o;;[ ; I" io.rb;T; 0; 0; 0[ [U:RDoc::Constant[i I" READABLE;TI"IO::READABLE;T:public0o;;[o;;[I"%Readable event mask for IO#wait.;T@; @L; 0@L@cRDoc::NormalClass0U;[i I" WRITABLE;TI"IO::WRITABLE;T;0o;;[o;;[I"%Writable event mask for IO#wait.;T@; @L; 0@L@@[0U;[i I" PRIORITY;TI"IO::PRIORITY;T;0o;;[o;;[I"%Priority event mask for IO#wait.;T@; @L; 0@L@@[0U;[i I"EWOULDBLOCKWaitReadable;TI" IO::EWOULDBLOCKWaitReadable;T;0o;;[o;;[I"#same as IO::EAGAINWaitReadable;T@; @L; 0@L@@[0U;[i I"EWOULDBLOCKWaitWritable;TI" IO::EWOULDBLOCKWaitWritable;T;0o;;[o;;[I"#same as IO::EAGAINWaitWritable;T@; @L; 0@L@@[0U;[i I" SEEK_SET;TI"IO::SEEK_SET;T;0o;;[o;;[I"(Set I/O position from the beginning;T@; @L; 0@L@@[0U;[i I" SEEK_CUR;TI"IO::SEEK_CUR;T;0o;;[o;;[I"/Set I/O position from the current position;T@; @L; 0@L@@[0U;[i I" SEEK_END;TI"IO::SEEK_END;T;0o;;[o;;[I""Set I/O position from the end;T@; @L; 0@L@@[0U;[i I"SEEK_DATA;TI"IO::SEEK_DATA;T;0o;;[o;;[I":Set I/O position to the next location containing data;T@; @L; 0@L@@[0U;[i I"SEEK_HOLE;TI"IO::SEEK_HOLE;T;0o;;[o;;[I"&Set I/O position to the next hole;T@; @L; 0@L@@[0[[I"File::Constants;To;;[ ; I"file.c;T; 0I"file.c;T[I"Enumerable;To;;[ ; @L; 0I" io.c;T[[I" class;T[[;[ [:protected[ [:private[[I"binread;T@�[I" binwrite;T@�[I"console;TI"ext/io/console/console.c;T[I"copy_stream;T@�[I"for_fd;T@�[I"foreach;T@�[I"new;T@�[I" open;T@�[I" pipe;T@�[I" popen;T@�[I" read;T@�[I"readlines;T@�[I"select;T@�[I"sysopen;T@�[I"try_convert;T@�[I" write;T@�[I" instance;T[[;[ [;[ [;[y[I"<<;T@�[I"advise;T@�[I"autoclose=;T@�[I"autoclose?;T@�[I" beep;T@�[I"binmode;T@�[I" binmode?;T@�[I"check_winsize_changed;T@�[I"clear_screen;T@�[I" close;T@�[I"close_on_exec=;T@�[I"close_on_exec?;T@�[I"close_read;T@�[I"close_write;T@�[I"closed?;T@�[I"console_mode;T@�[I"console_mode=;T@�[I"cooked;T@�[I"cooked!;T@�[I"cursor;T@�[I"cursor=;T@�[I"cursor_down;T@�[I"cursor_left;T@�[I"cursor_right;T@�[I"cursor_up;T@�[I" each;T@�[I"each_byte;T@�[I"each_char;T@�[I"each_codepoint;T@�[I"each_line;T@�[I" echo=;T@�[I" echo?;T@�[I"eof;T@�[I" eof?;T@�[I"erase_line;T@�[I"erase_screen;T@�[I"expect;TI"ext/pty/lib/expect.rb;T[I"external_encoding;T@�[I" fcntl;T@�[I"fdatasync;T@�[I"fileno;T@�[I" flush;T@�[I" fsync;T@�[I"getbyte;T@�[I" getc;T@�[I" getch;T@�[I"getpass;T@�[I" gets;T@�[I" goto;T@�[I"goto_column;T@�[I"iflush;T@�[I"inspect;T@�[I"internal_encoding;T@�[I" ioctl;T@�[I"ioflush;T@�[I"isatty;T@�[I"lineno;T@�[I"lineno=;T@�[I"noecho;T@�[I" nonblock;TI"ext/io/nonblock/nonblock.c;T[I"nonblock=;T@f[I"nonblock?;T@f[I" nread;TI"ext/io/wait/wait.c;T[I"oflush;T@�[I" path;T@�[I" pathconf;TI"ext/etc/etc.c;T[I"pid;T@�[I"pos;T@�[I" pos=;T@�[I" pread;T@�[I" pressed?;T@�[I" print;T@�[I"printf;T@�[I" putc;T@�[I" puts;T@�[I"pwrite;T@�[I"raw;T@�[I" raw!;T@�[I" read;T@�[I"read_nonblock;TI" io.rb;T[I" readbyte;T@�[I" readchar;T@�[I" readline;T@�[I"readlines;T@�[I"readpartial;T@�[I"ready?;T@m[I"reopen;T@�[I"rewind;T@�[I"scroll_backward;T@�[I"scroll_forward;T@�[I" seek;T@�[I"set_encoding;T@�[I"set_encoding_by_bom;T@�[I" stat;T@�[I" sync;T@�[I" sync=;T@�[I"sysread;T@�[I"sysseek;T@�[I" syswrite;T@�[I" tell;T@�[I"timeout;T@�[I" timeout=;T@�[I" to_i;T@�[I" to_io;T@�[I"to_path;T@�[I" tty?;T@�[I"ungetbyte;T@�[I"ungetc;T@�[I" wait;T@m[I"wait_priority;T@m[I"wait_readable;T@m[I"wait_writable;T@m[I"winsize;T@�[I" winsize=;T@�[I" write;T@�[I"write_nonblock;T@�[ [U:RDoc::Context::Section[i 0o;;[ ; 0; 0[I"ext/etc/etc.c;T@ I"ext/io/nonblock/nonblock.c;TI"ext/io/wait/wait.c;TI"ext/pty/lib/expect.rb;TI"file.c;TI" io.c;TI" io.rb;TI"lib/csv.rb;TI"lib/csv/writer.rb;TI"lib/rubygems.rb;TI"-lib/rubygems/package/tar_reader/entry.rb;TI"lib/rubygems/resolver.rb;TI"lib/rubygems/util.rb;T@OcRDoc::TopLevel