|
| 1 | +// |
| 2 | +// MessagePack for Java |
| 3 | +// |
| 4 | +// Copyright (C) 2009-2011 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 org.msgpack; |
| 19 | + |
| 20 | +import java.io.InputStream; |
| 21 | +import java.io.OutputStream; |
| 22 | +import java.io.IOException; |
| 23 | +import java.nio.ByteBuffer; |
| 24 | +import org.msgpack.template.Template; |
| 25 | +import org.msgpack.template.TemplateRegistry; |
| 26 | +import org.msgpack.packer.Packer; |
| 27 | +import org.msgpack.packer.BufferPacker; |
| 28 | +import org.msgpack.packer.JSONPacker; |
| 29 | +import org.msgpack.packer.JSONBufferPacker; |
| 30 | +import org.msgpack.unpacker.Unpacker; |
| 31 | +import org.msgpack.unpacker.BufferUnpacker; |
| 32 | +import org.msgpack.unpacker.JSONUnpacker; |
| 33 | +import org.msgpack.unpacker.JSONBufferUnpacker; |
| 34 | +import org.msgpack.type.Value; |
| 35 | + |
| 36 | + |
| 37 | +public class JSON extends MessagePack { |
| 38 | + public JSON() { |
| 39 | + super(); |
| 40 | + } |
| 41 | + |
| 42 | + public JSON(MessagePack msgpack) { |
| 43 | + super(msgpack); |
| 44 | + } |
| 45 | + |
| 46 | + |
| 47 | + @Override |
| 48 | + public Packer createPacker(OutputStream stream) { |
| 49 | + return new JSONPacker(this, stream); |
| 50 | + } |
| 51 | + |
| 52 | + @Override |
| 53 | + public BufferPacker createBufferPacker() { |
| 54 | + return new JSONBufferPacker(this); |
| 55 | + } |
| 56 | + |
| 57 | + @Override |
| 58 | + public BufferPacker createBufferPacker(int bufferSize) { |
| 59 | + return new JSONBufferPacker(this, bufferSize); |
| 60 | + } |
| 61 | + |
| 62 | + @Override |
| 63 | + public Unpacker createUnpacker(InputStream stream) { |
| 64 | + return new JSONUnpacker(this, stream); |
| 65 | + } |
| 66 | + |
| 67 | + @Override |
| 68 | + public BufferUnpacker createBufferUnpacker() { |
| 69 | + return new JSONBufferUnpacker(); |
| 70 | + } |
| 71 | + |
| 72 | + @Override |
| 73 | + public BufferUnpacker createBufferUnpacker(byte[] b) { |
| 74 | + return createBufferUnpacker().wrap(b); |
| 75 | + } |
| 76 | + |
| 77 | + @Override |
| 78 | + public BufferUnpacker createBufferUnpacker(byte[] b, int off, int len) { |
| 79 | + return createBufferUnpacker().wrap(b, off, len); |
| 80 | + } |
| 81 | + |
| 82 | + @Override |
| 83 | + public BufferUnpacker createBufferUnpacker(ByteBuffer bb) { |
| 84 | + return createBufferUnpacker().wrap(bb); |
| 85 | + } |
| 86 | +} |
| 87 | + |
0 commit comments