View Javadoc
1   /**
2    * Copyright 2014-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
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 org.kuali.common.jute.json;
17  
18  import java.io.File;
19  import java.io.IOException;
20  import java.net.URL;
21  
22  import com.google.common.io.ByteSink;
23  import com.google.common.io.ByteSource;
24  
25  public interface JsonService {
26  
27      <T> T readString(String json, Class<T> type);
28  
29      <T> T read(File file, Class<T> type) throws IOException;
30  
31      <T> T read(ByteSource source, Class<T> type) throws IOException;
32  
33      <T> T read(String url, Class<T> type) throws IOException;
34  
35      <T> T read(URL url, Class<T> type) throws IOException;
36  
37      <T> String writeString(T reference);
38  
39      <T> void write(File file, T reference) throws IOException;
40  
41      <T> void write(ByteSink sink, T reference) throws IOException;
42  
43  }