(io, stream)
| 804 | |
| 805 | |
| 806 | def decode_content(io, stream): |
| 807 | opcode = io.read(1) |
| 808 | if not opcode: |
| 809 | raise EOFError() |
| 810 | opcode = struct.unpack('>B', opcode)[0] |
| 811 | if opcode == Constants.TC_BLOCKDATA: |
| 812 | block_data = BlockData(stream) |
| 813 | content = block_data.decode(io) |
| 814 | elif opcode == Constants.TC_BLOCKDATALONG: |
| 815 | block_data_long = BlockDataLong(stream) |
| 816 | content = block_data_long.decode(io) |
| 817 | elif opcode == Constants.TC_ENDBLOCKDATA: |
| 818 | end_bd = EndBlockData(stream) |
| 819 | content = end_bd.decode(io) |
| 820 | elif opcode == Constants.TC_OBJECT: |
| 821 | new_object = NewObject(stream) |
| 822 | content = new_object.decode(io) |
| 823 | elif opcode == Constants.TC_CLASS: |
| 824 | new_class = NewClass(stream) |
| 825 | content = new_class.decode(io) |
| 826 | elif opcode == Constants.TC_ARRAY: |
| 827 | new_array = NewArray(stream) |
| 828 | content = new_array.decode(io) |
| 829 | elif opcode == Constants.TC_STRING: |
| 830 | utf = Utf(stream) |
| 831 | content = utf.decode(io) |
| 832 | if stream: |
| 833 | stream.add_reference(content) |
| 834 | elif opcode == Constants.TC_LONGSTRING: |
| 835 | long_utf = LongUtf(stream) |
| 836 | content = long_utf.decode(io) |
| 837 | if stream: |
| 838 | stream.add_reference(content) |
| 839 | elif opcode == Constants.TC_ENUM: |
| 840 | new_enum = NewEnum(stream) |
| 841 | content = new_enum.decode(io) |
| 842 | elif opcode == Constants.TC_CLASSDESC: |
| 843 | new_class_desc = NewClassDesc(stream) |
| 844 | content = new_class_desc.decode(io) |
| 845 | elif opcode == Constants.TC_PROXYCLASSDESC: |
| 846 | proxy = ProxyClassDesc(stream) |
| 847 | content = proxy.decode(io) |
| 848 | elif opcode == Constants.TC_REFERENCE: |
| 849 | ref = Reference(stream) |
| 850 | content = ref.decode(io) |
| 851 | elif opcode == Constants.TC_NULL: |
| 852 | ref = NullReference(stream) |
| 853 | content = ref.decode(io) |
| 854 | elif opcode == Constants.TC_EXCEPTION: |
| 855 | raise Exception("Failed to unserialize unsupported TC_EXCEPTION content") |
| 856 | elif opcode == Constants.TC_RESET: |
| 857 | reset = Reset(stream) |
| 858 | content = reset.decode(io) |
| 859 | else: |
| 860 | raise Exception('Failed to unserialize content') |
| 861 | return content |
| 862 | |
| 863 |
no test coverage detected