PageRenderTime 53ms CodeModel.GetById 25ms RepoModel.GetById 0ms 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. */
  16. package com.alibaba.dubbo.common.serialize.support.json;
  17. import java.io.IOException;
  18. import java.io.InputStream;
  19. import java.io.OutputStream;
  20. import com.alibaba.dubbo.common.URL;
  21. import com.alibaba.dubbo.common.serialize.ObjectInput;
  22. import com.alibaba.dubbo.common.serialize.ObjectOutput;
  23. import com.alibaba.dubbo.common.serialize.Serialization;
  24. /**
  25. * FastJsonSerialization
  26. *
  27. * @author william.liangf
  28. */
  29. public class FastJsonSerialization implements Serialization {
  30. public byte getContentTypeId() {
  31. return 6;
  32. }
  33. public String getContentType() {
  34. return "text/json";
  35. }
  36. public ObjectOutput serialize(URL url, OutputStream output) throws IOException {
  37. return new FastJsonObjectOutput(output);
  38. }
  39. public ObjectInput deserialize(URL url, InputStream input) throws IOException {
  40. return new FastJsonObjectInput(input);
  41. }
  42. }