module IO::Buffered
Overview
The IO::Buffered mixin enhances the IO module with input/output buffering.
The buffering behaviour can be turned on/off with the #sync= method.
Additionally, several methods, like #gets, are implemented in a more
efficient way.
Included Modules
Direct including types
Defined in:
io/buffered.crConstant Summary
- 
        BUFFER_SIZE = 
8192 
Instance Method Summary
- 
        #close
        
          
Flushes and closes the underlying IO.
 - 
        #flush
        
          
Flushes any buffered data and the underlying IO.
 - 
        #flush_on_newline=(flush_on_newline)
        
          
Turns on/off flushing the underlying IO when a newline is written.
 - 
        #flush_on_newline?
        
          
Determines if this IO flushes automatically when a newline is written.
 - 
        #read(slice : Slice(UInt8))
        
          
Buffered implementation of
IO#read(slice). - 
        #rewind
        
          
Rewinds the underlying IO.
 - 
        #sync=(sync)
        
          
Turns on/off IO buffering.
 - 
        #sync?
        
          
Determines if this IO does buffering.
 - 
        #unbuffered_close
        
          
Closes the wrapped IO.
 - 
        #unbuffered_flush
        
          
Flushes the wrapped IO.
 - 
        #unbuffered_read(slice : Slice(UInt8))
        
          
Reads at most slice.size bytes from the wrapped IO into slice.
 - 
        #unbuffered_rewind
        
          
Rewinds the wrapped IO.
 - 
        #unbuffered_write(slice : Slice(UInt8))
        
          
Writes at most slice.size bytes from slice into the wrapped IO.
 - 
        #write(slice : Slice(UInt8))
        
          
Buffered implementation of
IO#write(slice). 
Instance methods inherited from module IO
  
  
    
      <<(obj) : self
    <<, 
    
  
    
      close
    close, 
    
  
    
      closed?
    closed?, 
    
  
    
      cooked(&block)
    cooked, 
    
  
    
      cooked!
    cooked!, 
    
  
    
      each_byteeach_byte(&block) each_byte, each_char(&block)
each_char each_char, each_line(*args, **options)
each_line(*args, **options, &block) each_line, encoding : String encoding, flush flush, gets(limit : Int) : String | Nil
gets(delimiter : Char, limit : Int) : String | Nil
gets(delimiter : Char) : String | Nil
gets : String | Nil
gets(delimiter : String) : String | Nil gets, gets_to_end : String gets_to_end, print(obj) : Nil
print(*objects : _) : Nil print, printf(format_string, *args) : Nil
printf(format_string, args : Array | Tuple) : Nil printf, puts : Nil
puts(*objects : _) : Nil
puts(string : String) : Nil
puts(obj) : Nil puts, raw(&block) raw, raw! raw!, read(slice : Slice(UInt8)) read, read_byte : UInt8 | Nil read_byte, read_bytes(type, format : IO::ByteFormat = IO::ByteFormat::SystemEndian) read_bytes, read_char : Char | Nil read_char, read_fully(slice : Slice(UInt8)) read_fully, read_line(*args, **options) : String | Nil read_line, read_nonblock(size) read_nonblock, read_utf8(slice : Slice(UInt8)) read_utf8, read_utf8_byte read_utf8_byte, rewind rewind, set_encoding(encoding : String, invalid : Symbol | Nil = nil) set_encoding, skip(bytes_count : Int) : Nil skip, tty? : Bool tty?, write(slice : Slice(UInt8)) : Nil write, write_byte(byte : UInt8) write_byte, write_bytes(object, format : IO::ByteFormat = IO::ByteFormat::SystemEndian) write_bytes, write_utf8(slice : Slice(UInt8)) write_utf8
Class methods inherited from module IO
  
  
    
      copy(src, dst, limit : Int)copy(src, dst) copy, pipe(read_blocking = false, write_blocking = false, &block)
pipe(read_blocking = false, write_blocking = false) pipe, select(read_ios, write_ios, error_ios, timeout_sec : LibC::TimeT | Int | Float | Nil)
select(read_ios, write_ios = nil, error_ios = nil) select
Instance methods inherited from module JSON::Builder
  
  
    
      json_array(&block)
    json_array, 
    
  
    
      json_object(&block)
    json_object
    
  
    
  
Instance Method Detail
Turns on/off flushing the underlying IO when a newline is written.
Turns on/off IO buffering. When sync is set to true, no buffering
will be done (that is, writing to this IO is immediately synced to the
underlying IO).
Reads at most slice.size bytes from the wrapped IO into slice. Returns the number of bytes read.
Writes at most slice.size bytes from slice into the wrapped IO. Returns the number of bytes written.