7.12 editor-stream-out%

► |  | The Racket Graphical Interface Toolkit

1 | Windowing
2 | Widget Gallery
3 | Windowing Classes
4 | Windowing Functions
5 | Editors
6 | Snip and Style Classes
7 | Editor Classes
8 | Editor Functions
9 | WXME Decoding
10 | Preferences
11 | Dynamic Loading
12 | Startup Actions
13 | Init Libraries
14 | Platform Dependencies
| Index

▼ | 7 | Editor Classes

7.1 | editor<%>
7.2 | editor-admin%
7.3 | editor-canvas%
7.4 | editor-data%
7.5 | editor-data-class%
7.6 | editor-data-class-list<%>
7.7 | editor-snip-editor-admin<%>
7.8 | editor-snip%
7.9 | editor-stream-in%
7.10 | editor-stream-in-base%
7.11 | editor-stream-in-bytes-base%
7.12 | editor-stream-out%
7.13 | editor-stream-out-base%
7.14 | editor-stream-out-bytes-base%
7.15 | editor-wordbreak-map%
7.16 | keymap%
7.17 | pasteboard%
7.18 | text%

On this page:

make-object
jump-to
ok?
pretty-finish
pretty-start
put
put-fixed
put-unterminated
tell

Racket
top contents ← prev up next →

class editor-stream-out% : class?
superclass: object%

An editor-stream-out% object is used to write editor information to a file or other output stream (such as the clipboard).

> constructor (make-object editor-stream-out% base)
> → (is-a?/c editor-stream-out%)
> base : (is-a?/c editor-stream-out-base%)

An out-stream base—possibly an editor-stream-out-bytes-base% object—must be supplied in base.

> method (send an-editor-stream-out jump-to pos) → void?
> pos : exact-nonnegative-integer?

Jumps to a given position in the stream.

> method (send an-editor-stream-out ok?) → boolean?

Returns #t if the stream is ready for writing, #f otherwise. Writing to a bad stream has no effect.

> method (send an-editor-stream-out pretty-finish) → void?

Ensures that the stream ends with a newline. This method is called by write-editor-global-footer.

> method (send an-editor-stream-out pretty-start) → void?

Writes a “comment” into the stream that identifies the file format. This method is called by write-editor-global-header.

> method (send an-editor-stream-out put n v)
> → (is-a?/c editor-stream-out%)
> n : exact-nonnegative-integer?
> v : bytes?
> (send an-editor-stream-out put v)
> → (is-a?/c editor-stream-out%)
> v : bytes?
> (send an-editor-stream-out put v)
> → (is-a?/c editor-stream-out%)
> v : exact-integer?
> (send an-editor-stream-out put v)
> → (is-a?/c editor-stream-out%)
> v : real?

Writes v, or n bytes of v.

When n is supplied with a byte-string v, use get-unterminated-bytes to read the bytes later. This is the recommended way to write out bytes to be easily read in later; use get-unterminated-bytes to read the bytes back in.

If n is not supplied and v is a byte string, then for historical reasons, the actual number of bytes written includes a #\nul terminator, so use get-bytes instead of get-unterminated-bytes to read the bytes later.

If v is a real?, but not an exact-integer?, then it is converted to an inexact number as part of the process of writing it.

> method (send an-editor-stream-out put-fixed v)
> → (is-a?/c editor-stream-out%)
> v : (integer-in -9999999999 99999999999)

Puts a fixed-sized integer into the stream. This method is needed because numbers are usually written in a way that takes varying numbers of bytes. In some cases it is useful to temporary write a 0 to a stream, write more data, and then go back and change the 0 to another number; such a process requires a fixed-size number.

Numbers written to a stream with put-fixed must be read with get-fixed-exact or get-fixed.

> method (send an-editor-stream-out put-unterminated v)
> → (is-a?/c editor-stream-out%)
> v : bytes?

The same as calling put with (bytes-length v) and v.

> method (send an-editor-stream-out tell) → exact-nonnegative-integer?

Returns the current stream position.
top contents ← prev up next →