PageRenderTime 50ms CodeModel.GetById 43ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/support/json/FastJsonSerialization.java

https://gitlab.com/zouxc/dubbo
Java | 50 lines | 22 code | 8 blank | 20 comment | 0 complexity | a2acbde4e0505c115b8257acef63f65e MD5 | raw file
 1/*
 2 * Copyright 1999-2011 Alibaba Group.
 3 *  
 4 * Licensed under the Apache License, Version 2.0 (the "License");
 5 * you may not use this file except in compliance with the License.
 6 * You may obtain a copy of the License at
 7 *  
 8 *      http://www.apache.org/licenses/LICENSE-2.0
 9 *  
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package com.alibaba.dubbo.common.serialize.support.json;
17
18import java.io.IOException;
19import java.io.InputStream;
20import java.io.OutputStream;
21
22import com.alibaba.dubbo.common.URL;
23import com.alibaba.dubbo.common.serialize.ObjectInput;
24import com.alibaba.dubbo.common.serialize.ObjectOutput;
25import com.alibaba.dubbo.common.serialize.Serialization;
26
27/**
28 * FastJsonSerialization
29 * 
30 * @author william.liangf
31 */
32public class FastJsonSerialization implements Serialization {
33
34    public byte getContentTypeId() {
35        return 6;
36    }
37
38    public String getContentType() {
39        return "text/json";
40    }
41    
42    public ObjectOutput serialize(URL url, OutputStream output) throws IOException {
43        return new FastJsonObjectOutput(output);
44    }
45
46    public ObjectInput deserialize(URL url, InputStream input) throws IOException {
47        return new FastJsonObjectInput(input);
48    }
49
50}