Skip to content

Commit 8bb7eeb

Browse files
committed
Extracted low-level API. Need to clean up the rest away, and define our own templates.~
1 parent 4e72e3c commit 8bb7eeb

27 files changed

Lines changed: 4369 additions & 15 deletions
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
//
2+
// MessagePack for Java
3+
//
4+
// Copyright (C) 2009 - 2013 FURUHASHI Sadayuki
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
package com.blockwithme.msgpack;
19+
20+
import java.io.Closeable;
21+
import java.io.Flushable;
22+
import java.io.IOException;
23+
import java.math.BigInteger;
24+
import java.nio.ByteBuffer;
25+
26+
/**
27+
* Standard serializer in MessagePack for Java. It allows users to serialize
28+
* objects like <tt>String</tt>, <tt>List</tt>, <tt>Map</tt>, <tt>byte[]</tt>,
29+
* primitive types and so on.
30+
*/
31+
public interface Packer extends Closeable, Flushable {
32+
public Packer write(final boolean o) throws IOException;
33+
34+
public Packer write(final byte o) throws IOException;
35+
36+
public Packer write(final short o) throws IOException;
37+
38+
public Packer write(final char o) throws IOException;
39+
40+
public Packer write(final int o) throws IOException;
41+
42+
public Packer write(final long o) throws IOException;
43+
44+
public Packer write(final float o) throws IOException;
45+
46+
public Packer write(final double o) throws IOException;
47+
48+
public Packer write(final boolean[] o) throws IOException;
49+
50+
public Packer write(final short[] o) throws IOException;
51+
52+
public Packer write(final char[] o) throws IOException;
53+
54+
public Packer write(final int[] o) throws IOException;
55+
56+
public Packer write(final long[] o) throws IOException;
57+
58+
public Packer write(final float[] o) throws IOException;
59+
60+
public Packer write(final double[] o) throws IOException;
61+
62+
public Packer write(final Boolean o) throws IOException;
63+
64+
public Packer write(final Byte o) throws IOException;
65+
66+
public Packer write(final Short o) throws IOException;
67+
68+
public Packer write(final Character o) throws IOException;
69+
70+
public Packer write(final Integer o) throws IOException;
71+
72+
public Packer write(final Long o) throws IOException;
73+
74+
public Packer write(final Float o) throws IOException;
75+
76+
public Packer write(final Double o) throws IOException;
77+
78+
public Packer write(final BigInteger o) throws IOException;
79+
80+
public Packer write(final byte[] o) throws IOException;
81+
82+
public Packer write(final byte[] o, final int off, final int len)
83+
throws IOException;
84+
85+
public Packer write(final ByteBuffer o) throws IOException;
86+
87+
public Packer write(final String o) throws IOException;
88+
89+
public Packer writeNil() throws IOException;
90+
91+
public Packer writeArrayBegin(final int size) throws IOException;
92+
93+
public Packer writeArrayEnd(final boolean check) throws IOException;
94+
95+
public Packer writeArrayEnd() throws IOException;
96+
97+
public Packer writeMapBegin(final int size) throws IOException;
98+
99+
public Packer writeMapEnd(final boolean check) throws IOException;
100+
101+
public Packer writeMapEnd() throws IOException;
102+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
//
2+
// MessagePack for Java
3+
//
4+
// Copyright (C) 2009 - 2013 FURUHASHI Sadayuki
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
package com.blockwithme.msgpack;
19+
20+
import java.io.Closeable;
21+
import java.io.IOException;
22+
import java.math.BigInteger;
23+
import java.nio.ByteBuffer;
24+
25+
/**
26+
* Standard deserializer.
27+
*/
28+
public interface Unpacker extends Closeable {
29+
30+
public void skip() throws IOException;
31+
32+
public int readArrayBegin() throws IOException;
33+
34+
public void readArrayEnd(final boolean check) throws IOException;
35+
36+
public void readArrayEnd() throws IOException;
37+
38+
public int readMapBegin() throws IOException;
39+
40+
public void readMapEnd(final boolean check) throws IOException;
41+
42+
public void readMapEnd() throws IOException;
43+
44+
public void readNil() throws IOException;
45+
46+
public boolean trySkipNil() throws IOException;
47+
48+
public boolean readBoolean() throws IOException;
49+
50+
public byte readByte() throws IOException;
51+
52+
public short readShort() throws IOException;
53+
54+
public char readChar() throws IOException;
55+
56+
public int readInt() throws IOException;
57+
58+
public long readLong() throws IOException;
59+
60+
public BigInteger readBigInteger() throws IOException;
61+
62+
public float readFloat() throws IOException;
63+
64+
public double readDouble() throws IOException;
65+
66+
public byte[] readByteArray() throws IOException;
67+
68+
public boolean[] readBooleanArray() throws IOException;
69+
70+
public short[] readShortArray() throws IOException;
71+
72+
public char[] readCharArray() throws IOException;
73+
74+
public int[] readIntArray() throws IOException;
75+
76+
public long[] readLongArray() throws IOException;
77+
78+
public float[] readFloatArray() throws IOException;
79+
80+
public double[] readDoubleArray() throws IOException;
81+
82+
public ByteBuffer readByteBuffer() throws IOException;
83+
84+
public String readString() throws IOException;
85+
86+
public ValueType getNextType() throws IOException;
87+
88+
public void setRawSizeLimit(final int size);
89+
90+
public void setArraySizeLimit(final int size);
91+
92+
public void setMapSizeLimit(final int size);
93+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//
2+
// MessagePack for Java
3+
//
4+
// Copyright (C) 2009 - 2013 FURUHASHI Sadayuki
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
package com.blockwithme.msgpack;
19+
20+
public enum ValueType {
21+
NIL, BOOLEAN, INTEGER, FLOAT, ARRAY, MAP, RAW;
22+
}

0 commit comments

Comments
 (0)