# eric4.DebugClients.Ruby.AsyncFile

File implementing an asynchronous file like socket interface for the debugger.

### Classes

AsyncFile | Class wrapping a socket object with a file interface.

### Modules

None

### Functions

<< |
AsyncPendingWrite | Module function to check for data to be written.
close | Public method to close the file.
fileno | Public method returning the file number.
flush | Public method to write all pending bytes.
getSock | Public method to get the socket object.
isatty | Public method to indicate whether a tty interface is supported.
pendingWrite | Public method that returns the number of bytes waiting to be written.
read | Public method to read bytes from this file.
readline | Public method to read a line from this file.
readlines | Public method to read all lines from this file.
seek | Public method to move the filepointer.
tell | Synonym for write(s).
write | Public method to write a string to the file.
writelines | Public method to write a list of strings to the file.

## AsyncFile

Class wrapping a socket object with a file interface.

### Derived from

None

### Methods

checkMode | Private method to check the mode.
initialize | Constructor
nWrite | Private method to write a specific number of pending bytes.

#### AsyncFile.checkMode

checkMode()

Private method to check the mode.

This method checks, if an operation is permitted according to the mode of the file. If it is not, an IOError is raised.

mode
  the mode to be checked (string)

#### AsyncFile.initialize

initialize(mode, name)

Constructor

sock
  the socket object being wrapped
mode
  mode of this file (string)
name
  name of this file (string)

#### AsyncFile.nWrite

nWrite()

Private method to write a specific number of pending bytes.

n
  the number of bytes to be written (int)

Up

## <<

<<(s)
Up

## AsyncPendingWrite

AsyncPendingWrite(file)

Module function to check for data to be written.

file
  The file object to be checked (file)

Returns:
  Flag indicating if there is data wating (int)

Up

## close

close()

Public method to close the file.

Up

## fileno

fileno()

Public method returning the file number.

Returns:
  file number (int)

Up

## flush

flush()

Public method to write all pending bytes.

Up

## getSock

getSock()

Public method to get the socket object.

Returns:
  the socket object

Up

## isatty

isatty()

Public method to indicate whether a tty interface is supported.

Returns:
  always false

Up

## pendingWrite

pendingWrite()

Public method that returns the number of bytes waiting to be written.

Returns:
  the number of bytes to be written (int)

Up

## read

read(size = -1)

Public method to read bytes from this file.

size
  maximum number of bytes to be read (int)

Returns:
  the bytes read (any)

Up

## readline

readline(size = -1)

Public method to read a line from this file.

Note: This method will not block and may return only a part of a line if that is all that is available.

size
  maximum number of bytes to be read (int)

Returns:
  one line of text up to size bytes (string)

Up

## readlines

readlines(sizehint = -1)

Public method to read all lines from this file.

sizehint
  hint of the numbers of bytes to be read (int)

Returns:
  list of lines read (list of strings)

Up

## seek

seek(offset, whence=IO::SEEK_SET)

Public method to move the filepointer.

Raises IOError:
  This method is not supported and always raises an IOError.

Up

## tell

tell()

Synonym for write(s).

s
  bytes to be written (string)

Up

## write

write(s)

Public method to write a string to the file.

s
  bytes to be written (string)

Up

## writelines

writelines(list)

Public method to write a list of strings to the file.

list
  the list to be written (list of string)

Up