github.com/apache/beam/sdks/v2@v2.48.2/python/apache_beam/coders/stream.pxd (about) 1 # 2 # Licensed to the Apache Software Foundation (ASF) under one or more 3 # contributor license agreements. See the NOTICE file distributed with 4 # this work for additional information regarding copyright ownership. 5 # The ASF licenses this file to You under the Apache License, Version 2.0 6 # (the "License"); you may not use this file except in compliance with 7 # the License. You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 # 17 18 cimport libc.stdint 19 20 21 cdef class OutputStream(object): 22 cdef char* data 23 cdef size_t buffer_size 24 cdef size_t pos 25 26 cpdef write(self, bytes b, bint nested=*) 27 cpdef write_byte(self, unsigned char val) 28 cpdef write_var_int64(self, libc.stdint.int64_t v) 29 cpdef write_bigendian_int64(self, libc.stdint.int64_t signed_v) 30 cpdef write_bigendian_uint64(self, libc.stdint.uint64_t signed_v) 31 cpdef write_bigendian_int32(self, libc.stdint.int32_t signed_v) 32 cpdef write_bigendian_int16(self, libc.stdint.int16_t signed_v) 33 cpdef write_bigendian_double(self, double d) 34 cpdef write_bigendian_float(self, float d) 35 36 cpdef bytes get(self) 37 cpdef size_t size(self) except? -1 38 cdef extend(self, size_t missing) 39 cpdef _clear(self) 40 41 42 cdef class ByteCountingOutputStream(OutputStream): 43 cdef size_t count 44 45 cpdef write(self, bytes b, bint nested=*) 46 cpdef write_byte(self, unsigned char val) 47 cpdef write_bigendian_int64(self, libc.stdint.int64_t val) 48 cpdef write_bigendian_uint64(self, libc.stdint.uint64_t val) 49 cpdef write_bigendian_int32(self, libc.stdint.int32_t val) 50 cpdef write_bigendian_int16(self, libc.stdint.int16_t val) 51 cpdef size_t get_count(self) 52 cpdef bytes get(self) 53 54 55 cdef class InputStream(object): 56 cdef size_t pos 57 cdef bytes all 58 cdef char* allc 59 60 cpdef ssize_t size(self) except? -1 61 cpdef bytes read(self, size_t len) 62 cpdef long read_byte(self) except? -1 63 cpdef libc.stdint.int64_t read_var_int64(self) except? -1 64 cpdef libc.stdint.int64_t read_bigendian_int64(self) except? -1 65 cpdef libc.stdint.uint64_t read_bigendian_uint64(self) except? -1 66 cpdef libc.stdint.int32_t read_bigendian_int32(self) except? -1 67 cpdef libc.stdint.int16_t read_bigendian_int16(self) except? -1 68 cpdef double read_bigendian_double(self) except? -1 69 cpdef float read_bigendian_float(self) except? -1 70 cpdef bytes read_all(self, bint nested=*) 71 72 cpdef libc.stdint.int64_t get_varint_size(libc.stdint.int64_t value)