IO Library API - brombres/Rogue GitHub Wiki

BitIO.rogue

class BitReader

extends DataReader

Properties

Name Type Description
bit_buffer Int64
buffer_count Int
input Reader<<Byte>>
position Int

Methods

Signature Return Type Description
flush()
has_another() Logical
has_another( nbits:Int ) Logical
peek() Byte
peek( nbits:Int ) Int
read() Byte
read( nbits:Int ) Int

class BitWriter

extends DataWriter

Properties

Name Type Description
bit_buffer Int64
buffer_count Int
output Writer<<Byte>>
output_bytes Byte[] Only non-null when used with certain constructors
position Int

Methods

Signature Return Type Description
flush()
write( value:Byte )
write( value:Int, nbits:Int )

DataIO.rogue

class DataReader

extends Object

incorporates Reader<<$DataType>>

Properties

Name Type Description
input Reader<<Byte>>
position Int

Methods

Signature Return Type Description
init()
init( file:File )
init( input:Reader<<Byte>> )
init( list:Byte[] )
close()
has_another() Logical
on_end_use()
on_use() DataReader
peek() Byte
position() Int
read() Byte
read_byte() Byte
read_bytes() Byte[]
read_int16() Int Reads 2 bytes in high-low order, e.g. [99,AA] -> 99AA
read_int16_low_high() Int Reads 2 bytes in low-high order, e.g. [99,AA] -> AA99
read_int32() Int32 Reads 4 bytes in high-low order, e.g. [88,99,AA,BB] -> 8899AABB
read_int32_low_high() Int32 Reads 4 bytes in low-high order, e.g. [88,99,AA,BB] -> BBAA9988
read_int32_native_byte_order() Int32
read_int32x() Int
read_int64() Int64
read_int64x() Int64 Reads a variable-length encoded value that is stored in 1..10 bytes (or more if alignment padding is used). Encoded values are treated as signed.

- If the first two bits are not "10" then the first byte is cast to
  a signed integer value and returned. This allows for the range
  -64..127 using the following bit patterns:

    0xxxxxxx 0 .. 127
    11xxxxxx -64 .. -1

- If the first two bits are "10" then the data has been encoded
  in the next 6 bits as well as any number of following bytes,
  using 7 data bits per byte with an MSBit of 0 representing a halt
  or 1 a continuation. The next bit after the leading 10 is
  treated as negative magnitude.

    10xxxxxx 0yyyyyyy (13-bit number xxxxxxyyyyyyy)
    10xxxxxx 1yyyyyyy 0zzzzzzz (20-bit number xxxxxxyyyyyyyzzzzzzz)
    etc.
read_logical() Logical
read_real() Real
read_real32() Real32
read_real64() Real64
read( buffer:Byte[], limit:Int ) Int
read_bytes( buffer:Byte[] ) Byte[]
read_colors( [buffer=Graphics::Color[]:Color[]], [aligned_data=null:Int?] ) Color[]
read_string( [buffer=String():String] ) String
reset()
seek( pos:Int )
skip( n:Int )
to<<Byte[]>>() Byte[]
to<<String>>() String

class DataWriter

extends Object

incorporates Writer<<$DataType>>, Recyclable

Global Methods

Signature Return Type Description
int64x_byte_count( value:Int64 ) Int See read_int64x for format notes.

Properties

Name Type Description
output Writer<<Byte>>
output_bytes Byte[] Only non-null when used with certain constructors
position Int

Methods

Signature Return Type Description
init()
init( file:File )
init( output:Writer<<Byte>> )
init( output_bytes:Byte[] )
clear()
close()
flush()
on_recycle()
on_use() DataWriter
on_end_use( err:Exception ) Exception
output_bytes() Byte[]
patch_int32( pos:Int, value:Int )
position() Int
reset()
seek_end()
seek( pos:Int )
skip( n:Int )
write( list:Byte[] )
write( value:Byte )
write_byte( value:Byte )
write_bytes( data:Byte[], [index=0:Int], [count=null:Int?] )
write_colors( colors:Color[], [align_data=null:Int?] )
write_int16( value:Int ) Write 2 bytes in high-low order, e.g. 0x1234 -> [12,34]
write_int16_low_high( value:Int ) Writes 2 bytes in low-high order, e.g. 0x1234 -> [34,12]
write_int32( value:Int ) Writes 4 bytes in high-low order, e.g. 0x12345678 -> [12,34,56,78]
write_int32_low_high( value:Int ) Writes 4 bytes in low-high order, e.g. 0x12345678 -> [78,56,34,12]
write_int32_native_byte_order( value:Int32 )
write_int32x( value:Int )
write_int32x( value:Int, align:Int ) Pass e.g. align=4 to have the output position aligned on a 4-byte boundary AFTER this Int32X is written.
write_int64( value:Int64 )
write_int64x( value:Int64 ) See read_int64x for format notes.
write_int64x( value:Int64, align:Int ) Pass e.g. align=4 to have the output position aligned on a 4-byte boundary AFTER this Int64X is written.
write_logical( value:Logical )
write_real( value:Real )
write_real32( value:Real32 )
write_real64( value:Real64 )
write_string( value:String )

ExtendedASCIIReader.rogue

class ExtendedASCIIReader

extends Object

incorporates Reader<<$DataType>>

Properties

Name Type Description
byte_reader Reader<<Byte>>
next Character?
position Int

Methods

Signature Return Type Description
init( byte_reader:Reader<<Byte>> )
close()
has_another() Logical
on_end_use()
on_use() ExtendedASCIIReader
peek() Character
position() Int
read() Character
read( buffer:Character[], limit:Int ) Int
reset()
seek( pos:Int )
seek( pos:Int32 )
skip( n:Int )
skip( n:Int32 )
to<<Character[]>>() Character[]
to<<String>>() String

LineReader.rogue

class LineReader

extends Object

incorporates Reader<<$DataType>>

Properties

Name Type Description
internal_buffer String
next String
position Int
prev Character
source Reader<<Character>>

Methods

Signature Return Type Description
init( file:File, [encoding=StringEncoding.AUTODETECT:StringEncoding] )
init( reader:Reader<<Byte>>, [encoding=StringEncoding.AUTODETECT:StringEncoding] )
init( source:Reader<<Character>> )
init( string:String )
close()
disable_recycled_buffer()
has_another() Logical
on_end_use()
on_use() LineReader
peek() String
position() Int
prepare_next() Logical
read() String
read( buffer:String[], limit:Int ) Int
recycle()
reset()
seek( pos:Int )
set_use_recycled_buffer( setting:Logical )
skip( n:Int )
to<<String>>() String
to<<String[]>>() String[]
use_recycled_buffer()

PrintWriter.rogue

class BufferedPrintWriter

extends Object

incorporates PrintWriter, BufferedPrintWriter<<$buffer>>

Properties

Name Type Description
buffer String
output Writer<<Byte>>

Methods

Signature Return Type Description
init( output:Writer<<Byte>> )
close()
flush()
flush( buffer:String )
indent() Int
print( value:Byte )
print( value:Character )
print( value:Int32 )
print( value:Int64 )
print( value:Logical )
print( value:Object )
print( value:Real64 )
print( value:Real64, decimal_places:Int32 )
print( value:String )
println()
println( value:Byte )
println( value:Character )
println( value:Int32 )
println( value:Int64 )
println( value:Logical )
println( value:Object )
println( value:Real64 )
println( value:Real64, decimal_places:Int32 )
println( value:String )
set_indent( new_indent:Int )

class BufferedPrintWriter<<$buffer>> [aspect]

incorporates PrintWriter

Properties

Name Type Description
$buffer String

Methods

Signature Return Type Description
close()
flush()
flush( buffer:String )
indent() Int
print( value:Byte )
print( value:Character )
print( value:Int32 )
print( value:Int64 )
print( value:Logical )
print( value:Object )
print( value:Real64 )
print( value:Real64, decimal_places:Int32 )
print( value:String )
println()
println( value:Byte )
println( value:Character )
println( value:Int32 )
println( value:Int64 )
println( value:Logical )
println( value:Object )
println( value:Real64 )
println( value:Real64, decimal_places:Int32 )
println( value:String )
set_indent( new_indent:Int )

class PrintWriter [aspect]

Global Methods

Signature Return Type Description
create( writer:Writer<<Byte>> ) PrintWriter

Methods

Signature Return Type Description
close()
flush()
indent() Int
print( value:Byte )
print( value:Character )
print( value:Int32 )
print( value:Int64 )
print( value:Logical )
print( value:Object )
print( value:Real64 )
print( value:Real64, decimal_places:Int32 )
print( value:String )
println()
println( value:Byte )
println( value:Character )
println( value:Int32 )
println( value:Int64 )
println( value:Logical )
println( value:Object )
println( value:Real64 )
println( value:Real64, decimal_places:Int32 )
println( value:String )
set_indent( new_indent:Int )

Reader.rogue

class Reader<<$DataType>> [aspect]

Properties

Name Type Description
position Int

Methods

Signature Return Type Description
close()
has_another() Logical
on_end_use()
on_use() Reader<<$DataType>>
peek() $DataType
position() Int
read() $DataType
read( buffer:List<<$DataType>>, limit:Int ) Int
reset()
seek( pos:Int )
skip( n:Int )
to<<$DataType[]>>() List<<$DataType>>
to<<String>>() String

Scanner.rogue

class Scanner

extends Object

incorporates Reader<<$DataType>>

Properties

Name Type Description
column Int
count Int
data Character[]
line Int
position Int
source String
spaces_per_tab Int

Methods

Signature Return Type Description
init( file:File, [spaces_per_tab=0:Int] )
init( source:Character[], [spaces_per_tab=0:Int], &preserve_crlf )
init( source:String, [spaces_per_tab=0:Int], &preserve_crlf )
init( value:Variant, [spaces_per_tab=0:Int], &preserve_crlf )
close()
consume_eols() Logical
consume_spaces() Logical
consume_whitespace() Logical
consume( ch:Character ) Logical
consume( pattern:ScanPattern, [buffer=null:String] ) Logical
consume( text:String ) Logical
consume_any( ch:Character ) Logical
consume_any( characters:String ) Logical
consume_id( text:String ) Logical deprecated
consume_identifier( text:String ) Logical
has_another() Logical
has_another( n:Int ) Logical
location() ScannerLocation
next_is_hex_digit() Logical
next_is_real_number() Logical
next_is_string() Logical
next_is( ch:Character ) Logical
next_is( pattern:ScanPattern ) Logical
next_is( text:String ) Logical
next_is_identifier( [additional_characters="":String] ) Logical
next_is_number( [base=10:Int] ) Logical
on_end_use()
on_use() Scanner
peek() Character
peek( lookahead:Int ) Character Zero-based
position() Int
read() Character
read_hex_value() Int
read( buffer:Character[], limit:Int ) Int
read_line( [buffer=String():String] ) String
reset()
scan_real() Real
scan_string() String
scan_args( [separator="":String] ) String[]
scan_escaped_string( [separator="":String] ) String
scan_hex_sequence( buffer:String )
scan_hex_value( [digits=6:Int], &variable_length ) Int
scan_identifier( [additional_characters="":String], [buffer=null:String] ) String
scan_int( [base=10:Int] ) Int
scan_int64( [base=10:Int] ) Int64
scan_number_string( buffer:String ) Logical Returns true if number string contains a decimal point or an exponent
scan_string( open:Character, close:Character, [buffer=null:String] ) String
scan_string_character( buffer:String )
seek( pos:Int )
seek_location( new_line:Int, new_column:Int )
set_location( line:Int, column:Int )
set_location( loc:ScannerLocation )
skip( n:Int )
to<<Character[]>>() Character[]
to<<String>>() String

class ScannerLocation [compound]

incorporates CommonCompoundMethods

Global Methods

Signature Return Type Description
create( position:Int, line:Int, column:Int ) ScannerLocation

Properties

Name Type Description
column Int
line Int
position Int

Methods

Signature Return Type Description
description() String
operator==( other:ScannerLocation ) Logical
print_to( buffer:PrintWriter )
to<<Object>>() Boxed<<ScannerLocation>>
to<<String>>() String
to<<Variant>>() Variant
type_info() TypeInfo

ScanPattern.rogue

class AnyCharacterScanPattern

extends ScanPattern

Methods

Signature Return Type Description
init()
scan( scanner:Scanner, [builder=null:String] ) Logical
to<<String>>() String

class LiteralStringScanPattern

extends ScanPattern

Properties

Name Type Description
characters String

Methods

Signature Return Type Description
init( characters:String )
scan( scanner:Scanner, [builder=null:String] ) Logical
to<<String>>() String

class LowHighSetScanPattern

extends ScanPattern

Properties

Name Type Description
characters String
invert Logical
pattern String

Methods

Signature Return Type Description
init( pattern:String ) e.g.: _A-Za-z0-9 -> __AZaz09
scan( scanner:Scanner, [builder=null:String] ) Logical
to<<String>>() String

class OneOrMoreScanPattern

extends ScanPattern

Properties

Name Type Description
operand ScanPattern

Methods

Signature Return Type Description
init( operand:ScanPattern )
scan( scanner:Scanner, [builder=null:String] ) Logical
to<<String>>() String

class ScanPattern

extends Object

Global Methods

Signature Return Type Description
create( pattern:String ) ScanPattern
escape( pattern:String, at_escape:String ) String

Methods

Signature Return Type Description
is_next( scanner:Scanner ) Logical
scan( scanner:Scanner, [builder=null:String] ) Logical

class ScanPatternList

extends ScanPattern

Properties

Name Type Description
patterns ScanPattern[]

Methods

Signature Return Type Description
init( patterns:ScanPattern[] )
add( pattern:ScanPattern )
scan( scanner:Scanner, [builder=null:String] ) Logical
to<<String>>() String

class ScanPatternParser [singleton]

extends Object

Properties

Name Type Description
builder String
list_start Int[]
scanner Scanner
stack ScanPattern[]
state Int

Methods

Signature Return Type Description
charset_to_scan_pattern( charset:String ) ScanPattern
parse( pattern:String ) ScanPattern

class ScanPatternRoot

extends ScanPattern

Properties

Name Type Description
pattern ScanPattern

Methods

Signature Return Type Description
init( pattern:ScanPattern )
scan( scanner:Scanner, [builder=null:String] ) Logical Ensure that a zero-length match doesn't return 'true'
to<<String>>() String

class SinglesSetScanPattern

extends ScanPattern

Properties

Name Type Description
characters String
invert Logical
pattern String

Methods

Signature Return Type Description
init( pattern:String )
scan( scanner:Scanner, [builder=null:String] ) Logical
to<<String>>() String

class ZeroOrMoreScanPattern

extends ScanPattern

Properties

Name Type Description
operand ScanPattern

Methods

Signature Return Type Description
init( operand:ScanPattern )
scan( scanner:Scanner, [builder=null:String] ) Logical
to<<String>>() String

class ZeroOrOneScanPattern

extends ScanPattern

Properties

Name Type Description
operand ScanPattern

Methods

Signature Return Type Description
init( operand:ScanPattern )
scan( scanner:Scanner, [builder=null:String] ) Logical
to<<String>>() String

UTF8.rogue

class CharacterToUTF8ByteWriter

extends Object

incorporates Writer<<$DataType>>

Properties

Name Type Description
byte_writer Writer<<Byte>>
position Int

Methods

Signature Return Type Description
init( byte_writer:Writer<<Byte>> )
close()
flush()
on_use() CharacterToUTF8ByteWriter
on_end_use( err:Exception ) Exception
position() Int
reset()
seek_end()
seek( pos:Int )
seek( pos:Int32 )
skip( n:Int )
skip( n:Int32 )
write( list:Character[] )
write( value:Character )

class UTF8ByteToCharacterWriter

extends Object

incorporates Writer<<$DataType>>

Properties

Name Type Description
bytes Byte[]
character_writer Writer<<Character>>
position Int

Methods

Signature Return Type Description
init( character_writer:Writer<<Character>> )
close()
flush()
on_use() UTF8ByteToCharacterWriter
on_end_use( err:Exception ) Exception
position() Int
reset()
seek_end()
seek( pos:Int )
seek( pos:Int32 )
skip( n:Int )
skip( n:Int32 )
write( list:Byte[] )
write( value:Byte )

class UTF8Reader

extends Object

incorporates Reader<<$DataType>>

Properties

Name Type Description
byte_reader Reader<<Byte>>
next Character?
position Int

Methods

Signature Return Type Description
init( byte_reader:Reader<<Byte>> )
close()
has_another() Logical
on_end_use()
on_use() UTF8Reader
peek() Character
position() Int
read() Character
read( buffer:Character[], limit:Int ) Int
reset()
seek( pos:Int )
seek( pos:Int32 )
skip( n:Int )
skip( n:Int32 )
to<<Character[]>>() Character[]
to<<String>>() String

Writer.rogue

class Writer<<$DataType>> [aspect]

Properties

Name Type Description
position Int

Methods

Signature Return Type Description
close()
flush()
on_use() Writer<<$DataType>>
on_end_use( err:Exception ) Exception
position() Int
reset()
seek_end()
seek( pos:Int )
skip( n:Int )
write( list:List<<$DataType>> )
write( value:$DataType )
⚠️ **GitHub.com Fallback** ⚠️