spoon.ber.stream

Package spoon :: Package ber :: Module stream |
[hide private]
[frames] | no frames]

# Module stream

source code

Classes | [hide private]
`` | CountingFile
`` | BERStream FIXME docs
`` | zencoder
`` | encoder
`` | decoder

Functions | [hide private]
`` | encode_container(fd, tag, items) Encode a list of items into a container with the given tag and write it to a stream.
`list` | decode_container(fd, tag) Decode a container into a list of items.
`` | encode_null(fd, item)
`` | decode_null(fd, tag)
`` | encode_bool(fd, item)
`` | decode_bool(fd, tag)
`` | encode_int(fd, item)
`` | decode_int(fd, tag)
`` | encode_str(fd, item)
`` | decode_str(fd, tag)
`` | encode_unicode(fd, item)
`` | decode_unicode(fd, tag)
`` | encode_list(fd, items)
`` | decode_list(fd, tag)

Variables | [hide private]
`` | UNIVERSAL_BOOL = `1`
`` | UNIVERSAL_INT = `2`
`` | UNIVERSAL_BYTES = `4`
`` | UNIVERSAL_NULL = `5`
`` | UNIVERSAL_UTF8 = `12`
`` | UNIVERSAL_LIST = `16`
`` | EOF_TYPE = `<ASN.1 Tag(UNIVERSAL, 0, size=0, container=False)>`
`` | NULL_TYPE = `<ASN.1 Tag(UNIVERSAL, 5, size=None, container=False)>`
`` | BOOL_TYPE = `<ASN.1 Tag(UNIVERSAL, 1, size=None, container=False)>`
`` | INT_TYPE = `<ASN.1 Tag(UNIVERSAL, 2, size=None, container=False)>`
`` | BYTES_TYPE = `<ASN.1 Tag(UNIVERSAL, 4, size=None, container=False)>`
`` | UTF8_TYPE = `<ASN.1 Tag(UNIVERSAL, 12, size=None, container=False)>`
`` | LIST_TYPE = `<ASN.1 Tag(UNIVERSAL, 16, size=None, container=True)>`

Function Details | [hide private]

### encode_container(fd, tag, items) | source code
Encode a list of items into a container with the given tag and write it to a stream. The list is written using indefinite-length encoding, so no extra copying occurs. Parameters: `fd` (`file`) - the file object to write into `tag` (`Tag`) - the tag to use for this list `items` (`list or iterable`) - a list of items to put into the container

### decode_container(fd, tag) | source code
Decode a container into a list of items. Parameters: `fd` (`file`) - the file object to read from `tag` (`Tag`) - the tag from the container Returns: `list` a list of decoded objects

### encode_null(fd, item) | source code
None Decorators: `@encoder(type(None))`

### decode_null(fd, tag) | source code
None Decorators: `@decoder(NULL_TYPE)`

### encode_bool(fd, item) | source code
None Decorators: `@encoder(bool)`

### decode_bool(fd, tag) | source code
None Decorators: `@decoder(BOOL_TYPE)`

### encode_int(fd, item) | source code
None Decorators: `@encoder(int, long)`

### decode_int(fd, tag) | source code
None Decorators: `@decoder(INT_TYPE)`

### encode_str(fd, item) | source code
None Decorators: `@encoder(str)`

### decode_str(fd, tag) | source code
None Decorators: `@decoder(BYTES_TYPE)`

### encode_unicode(fd, item) | source code
None Decorators: `@encoder(unicode)`

### decode_unicode(fd, tag) | source code
None Decorators: `@decoder(UTF8_TYPE)`

### encode_list(fd, items) | source code
None Decorators: `@encoder(list, tuple)`

### decode_list(fd, tag) | source code
None Decorators: `@decoder(LIST_TYPE)`

Variables Details | [hide private]

    ### UNIVERSAL_BOOL None Value:
        1

    ### UNIVERSAL_INT None Value:
        2

    ### UNIVERSAL_BYTES None Value:
        4

    ### UNIVERSAL_NULL None Value:
        5

    ### UNIVERSAL_UTF8 None Value:
        12

    ### UNIVERSAL_LIST None Value:
        16

    ### EOF_TYPE None Value:
        <ASN.1 Tag(UNIVERSAL, 0, size=0, container=False)>

    ### NULL_TYPE None Value:
        <ASN.1 Tag(UNIVERSAL, 5, size=None, container=False)>

    ### BOOL_TYPE None Value:
        <ASN.1 Tag(UNIVERSAL, 1, size=None, container=False)>

    ### INT_TYPE None Value:
        <ASN.1 Tag(UNIVERSAL, 2, size=None, container=False)>

    ### BYTES_TYPE None Value:
        <ASN.1 Tag(UNIVERSAL, 4, size=None, container=False)>

    ### UTF8_TYPE None Value:
        <ASN.1 Tag(UNIVERSAL, 12, size=None, container=False)>

    ### LIST_TYPE None Value:
        <ASN.1 Tag(UNIVERSAL, 16, size=None, container=True)>