Debian Codegraph @

proton-j/src/main/java/org/apache/qpid/proton/codec/Data.java

raw
1 /*
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 */
21 package org.apache.qpid.proton.codec;
22
23 import java.nio.ByteBuffer;
24 import java.util.Date;
25 import java.util.List;
26 import java.util.Map;
27 import java.util.UUID;
28 import org.apache.qpid.proton.amqp.Binary;
29 import org.apache.qpid.proton.amqp.Decimal128;
30 import org.apache.qpid.proton.amqp.Decimal32;
31 import org.apache.qpid.proton.amqp.Decimal64;
32 import org.apache.qpid.proton.amqp.DescribedType;
33 import org.apache.qpid.proton.amqp.Symbol;
34 import org.apache.qpid.proton.amqp.UnsignedByte;
35 import org.apache.qpid.proton.amqp.UnsignedInteger;
36 import org.apache.qpid.proton.amqp.UnsignedLong;
37 import org.apache.qpid.proton.amqp.UnsignedShort;
38
39 import org.apache.qpid.proton.codec.impl.DataImpl;
40
41 public interface Data
42 {
43
44 public static final class Factory {
45
46 public static Data create() {
47 return new DataImpl();
48 }
49
50 }
51
52
53 enum DataType
54 {
55 NULL,
56 BOOL,
57 UBYTE,
58 BYTE,
59 USHORT,
60 SHORT,
61 UINT,
62 INT,
63 CHAR,
64 ULONG,
65 LONG,
66 TIMESTAMP,
67 FLOAT,
68 DOUBLE,
69 DECIMAL32,
70 DECIMAL64,
71 DECIMAL128,
72 UUID,
73 BINARY,
74 STRING,
75 SYMBOL,
76 DESCRIBED,
77 ARRAY,
78 LIST,
79 MAP
80 }
81
82 void free();
83
84 void clear();
85 long size();
86 void rewind();
87 DataType next();
88 DataType prev();
89 boolean enter();
90 boolean exit();
91
92 DataType type();
93
94 Binary encode();
95 long encodedSize();
96 long encode(ByteBuffer buf);
97 long decode(ByteBuffer buf);
98
99 void putList();
100 void putMap();
101 void putArray(boolean described, DataType type);
102 void putDescribed();
103 void putNull();
104 void putBoolean(boolean b);
105 void putUnsignedByte(UnsignedByte ub);
106 void putByte(byte b);
107 void putUnsignedShort(UnsignedShort us);
108 void putShort(short s);
109 void putUnsignedInteger(UnsignedInteger ui);
110 void putInt(int i);
111 void putChar(int c);
112 void putUnsignedLong(UnsignedLong ul);
113 void putLong(long l);
114 void putTimestamp(Date t);
115 void putFloat(float f);
116 void putDouble(double d);
117 void putDecimal32(Decimal32 d);
118 void putDecimal64(Decimal64 d);
119 void putDecimal128(Decimal128 d);
120 void putUUID(UUID u);
121 void putBinary(Binary bytes);
122 void putBinary(byte[] bytes);
123 void putString(String string);
124 void putSymbol(Symbol symbol);
125 void putObject(Object o);
126 void putJavaMap(Map<Object, Object> map);
127 void putJavaList(List<Object> list);
128 void putDescribedType(DescribedType dt);
129
130 long getList();
131 long getMap();
132 long getArray();
133 boolean isArrayDescribed();
134 DataType getArrayType();
135 boolean isDescribed();
136 boolean isNull();
137 boolean getBoolean();
138 UnsignedByte getUnsignedByte();
139 byte getByte();
140 UnsignedShort getUnsignedShort();
141 short getShort();
142 UnsignedInteger getUnsignedInteger();
143 int getInt();
144 int getChar();
145 UnsignedLong getUnsignedLong();
146 long getLong();
147 Date getTimestamp();
148 float getFloat();
149 double getDouble();
150 Decimal32 getDecimal32();
151 Decimal64 getDecimal64();
152 Decimal128 getDecimal128();
153 UUID getUUID();
154 Binary getBinary();
155 String getString();
156 Symbol getSymbol();
157 Object getObject();
158 Map<Object, Object> getJavaMap();
159 List<Object> getJavaList();
160 Object[] getJavaArray();
161 DescribedType getDescribedType();
162
163 String format();
164 }