Chinaunix首页 | 论坛 | 博客
  • 博客访问: 94628
  • 博文数量: 11
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 191
  • 用 户 组: 普通用户
  • 注册时间: 2013-10-18 16:33
个人简介

有二事焉,恒然于心,敬之畏之,日省日甚!外乎者如璀璨星穹,内在者犹道德律令。

文章分类

全部博文(11)

文章存档

2017年(7)

2014年(2)

2013年(2)

我的朋友

分类: Java

2014-01-02 20:06:15

javax.json

Class Json

java.lang.Object
   \_javax.json.Json
-----------------------------------------------

public class Json extends Object

Factory class for creating JSON processing objects. This class provides the most commonly used methods for creating these objects and their corresponding factories. The factory classes provide all the various ways to creating these objects.(创建JSON处理对象的工厂类。本类提供了一般情况下常用的创建这些对象(译者注:指前面说的JSON处理对象)和其对应工厂的方法。这个工厂类提供了创建这些对象的多种方式)

The methods in this class locate a provider instance using the method JsonProvider.provider(). This class uses the provider instance to create JSON processing objects.(在本类中的方法都用JsonProvider.provider()这个方法来定位(译者注:这里直译成定位,但是locate有寻找、获取、加载的意思)一个provider实例。本类使用provider的实例去创建JSON处理对象)

The following example shows how to create a JSON parser to parse an empty array:(下面的例子展示了如何创建一个JSON解析器来解析一个空数组)

StringReader reader = new StringReader("[]");
JsonParser parser = Json.createParser(reader);

All the methods in this class are safe for use by multiple concurrent threads.(本类中的所有方法都是线程安全的)

Author:
    Jitendra Kotamraju

Method Summary:
    * static JsonArrayBuilder createArrayBuilder()
      
Creates a JSON array builder(创建一个JSON数组建造者)

    * static JsonBuilderFactory createBuilderFactory(Map config)
      Creates a builder factory for creating JsonArrayBuilder and JsonObjectBuilder objects.(创建一个用于创建JsonArrayBuilder
      和JsonObjectBuilder对象的
建造者工厂)

    * static JsonGenerator createGenerator(OutputStream out)
      Creates a JSON generator for writing JSON to a byte stream.(创建一个用于将JSON写入到字节流的JSON生成器)

    * static JsonGenerator createGenerator(Writer writer)
      Creates a JSON generator for writing JSON to a character stream.(创建一个用于将JSON写入到字符流的JSON生成器)

    * static JsonGeneratorFactory createGeneratorFactory(Map config)
      Creates a generator factory for creating JsonGenerator objects.(创建一个用于创建JsonGenerator对象的生成器工厂)

    * static JsonObjectBuilder createObjectBuilder()
      Creates a JSON object builder(创建一个JSON对象建造者)

    * static JsonParser createParser(InputStream in)
      Creates a JSON parser from a byte stream.(用字节流创建一个JSON解析器)

    * static JsonParser createParser(Reader reader)
      Creates a JSON parser from a character stream.(用字符流创建一个JSON解析器)

    * static JsonParserFactory createParserFactory(Map config)
      Creates a parser factory for creating JsonParser objects.(为了创建JsonParser对象而创建一个解析器工厂)

    * static JsonReader createReader(InputStream in)
      Creates a JSON reader from a byte stream.(用字节流创建一个JSON读取器)

    * static JsonReader createReader(Reader reader)
      Creates a JSON reader from a character stream.(用字符流创建一个JSON读取器)

    * static JsonReaderFactory createReaderFactory(Map config)
      Creates a reader factory for creating JsonReader objects.(为了创建JsonReader对象而创建一个读取器工厂)

    * static JsonWriter createWriter(OutputStream out)
      Creates a JSON writer to write a JSON object or array structure to the specified byte stream.(创建一个JSON写入器将结构化的JSON对
      象或数组写入到指定的字节流里
)

    * static JsonWriter createWriter(Writer writer)
      Creates a JSON writer to write a JSON object or array structure to the specified character stream.(创建一个JSON写入器将结构化的
      JSON对象或数组写入到指定的字符
流里)

    * static JsonWriterFactory createWriterFactory(Map config)
      Creates a writer factory for creating JsonWriter objects.(为了创建JsonWriter对象而创建一个写入器工厂)


Method Detail:
    * public static JsonParser createParser(Reader reader)
      Creates a JSON parser from a character stream.(用字符流创建一个JSON解析器)
      Parameters:
          reader - i/o reader from which JSON is to be read(将要从其中读取JSON的i/o字符流)
      Returns:
          a JSON parser(一个JSON解析器)

    * public static JsonParser createParser(InputStream in)
      Creates a JSON parser from a byte stream. The character encoding of the stream is determined as specified in RFC 4627.(用给
      定的字节流创建一个JSON解析器,字节流
编码由RFC 4627决定
)

      Parameters:
          in - i/o stream from which JSON is to be read(将要从其中读取JSON的i/o字节流)
      Returns:
          a JSON parser(一个JSON解析器)
      Throws:
          JsonException - if encoding cannot be determined or i/o error (IOException would be cause of JsonException)(如果编码不能
                          确定或者i/o错误(IOException可能会引
起JsonException))

     
    * public static JsonGenerator createGenerator(Writer writer)
      Creates a JSON generator for writing JSON to a character stream.(创建一个JSON生产者用于将JSON写入字符流)
      Parameters:
          writer - a i/o writer to which JSON is written(那个将要被写入JSON的字符流)
      Returns:
          a JSON generator(一个JSON生成器)
     
    * public static JsonGenerator createGenerator(OutputStream out)
      Creates a JSON generator for writing JSON to a byte stream.(创建将JSON文本写入字节流的JSON生成器)
      Parameters:
          out - i/o stream to which JSON is written(那个将要被写入JSON的字节流)
      Returns:
          a JSON generator(一个JSON生成器)

    * public static JsonParserFactory createParserFactory(Map config)

      Creates a parser factory for creating JsonParser objects. The factory is configured with the specified map of provider
      specific configuration properties. Provider 
implementations should ignore any unsupported configuration properties
      specified in the map.
(创建一个能够创建JsonParser的解析器工厂,该工厂被provider指定的配置项的特定map所配置。provider的实现应当忽略
      map中的任
何一个不支持的配置项)

      Parameters:
          config - a map of provider specific properties to configure the JSON parsers. The map may be empty or null(用于配置JSON
                   解析器的provider指定的配置项组
成的map,该map可能是空或null)

      Returns:
          JSON parser factory(JSON解析器工厂)
      
    * public static JsonGeneratorFactory createGeneratorFactory(Map config)
      Creates a generator factory for creating JsonGenerator objects. The factory is configured with the specified map of
      provider specific configuration properties. Provider implementations should ignore any unsupported configuration
      properties specified in the map.(创建一个能够创建JsonGenerator实例的生成器工厂,该工厂被包含provider指定的配置项的特定map所配置。
      provider的实现应当忽略map中的任何一个不支持的配置项)

      Parameters:
          config - a map of provider specific properties to configure the JSON generators. The map may be empty or null(一个包含
                   provider指定的配置项的用于配置JSON生成器的map,该map可能是空或null)

      Returns:
          JSON generator factory(一个JSON生成器工厂)
     
    * public static JsonWriter createWriter(Writer writer)
      Creates a JSON writer to write a JSON object or array structure to the specified character stream.(创建一个JSON写入器将JSON
      对象或数组等结构化的东西写入到指定的字符流里(译者注:参数的Writer是字符流,而返回结果是对JSON进行操作的Writer。不一样))

      Parameters:
          writer - to which JSON object or array is written(那个将被写入JSON对象或数组的字符流)
      Returns:
          a JSON writer(一个JSON写入器)
     
    * public static JsonWriter createWriter(OutputStream out)
      Creates a JSON writer to write a JSON object or array structure to the specified byte stream. Characters written to the
      stream are encoded into bytes using UTF-8 encoding.(创建一个JSON写入器将JSON对象或数组等结构化的东西写入到指定的字节流里,写入到流里
      的字符被UTF-8编码规则转为字节)

      Parameters:
          out - to which JSON object or array is written(那个将被写入JSON对象或数组的字节流)
      Returns:
          a JSON writer(一个JSON写入器)

    * public static JsonReader createReader(Reader reader)
      Creates a JSON reader from a character stream.(从一个字符流创建一个JSON读取器)
      Parameters:
          reader - a reader from which JSON is to be read(那个将要从其中读取JSON的字符流)
      Returns:
          a JSON reader(一个JSON读取器)

    * public static JsonReader createReader(InputStream in)
      Creates a JSON reader from a byte stream. The character encoding of the stream is determined as described in RFC 4627(从一个
      字节流创建一个JSON读取器。这个字节流的字符编码由RFC 4627规范来决定)
      Parameters:
          in - a byte stream from which JSON is to be read(那个将要从其中读取JSON的字节流)
      Returns:
          a JSON reader(一个JSON读取器)

    * public static JsonReaderFactory createReaderFactory(Map config)
      Creates a reader factory for creating JsonReader objects. The factory is configured with the specified map of provider specific
      configuration properties. Provider implementations should ignore any unsupported configuration properties specified in the map.(
      建一个能够创建JsonReader实例的读取器工厂,该工厂被包含provider指定的配置项的特定map所配置。provider的实现应当忽略map中的任何一个不支持的配
      置项
)

      Parameters:
          config - a map of provider specific properties to configure the JSON readers. The map may be empty or null(一个包含provider指定
                   的配置项用于配置JSON读取器的map,该map可能是空或null
)
     
Returns:
          a JSON reader factory(一个JSON读取器工厂)
      
    * public static JsonWriterFactory createWriterFactory(Map config)
      Creates a writer factory for creating JsonWriter objects. The factory is configured with the specified map of provider specific
      configuration properties. Provider implementations should ignore any unsupported configuration properties specified in the map.(
      建一个能够创建JsonWriter实例的写入器工厂,该工厂被包含provider指定的配置项的特定map所配置。provider的实现应当忽略map中的任何一个不支持的配
      置项)

      Parameters:
          config - a map of provider specific properties to configure the JSON writers. The map may be empty or null(一个包含provider指定
                  配置项用于配置JSON写入器的map,该map可能是空或null)

      Returns:
          a JSON writer factory(一个JSON写入器工厂)
      
    * public static JsonArrayBuilder createArrayBuilder()
      Creates a JSON array builder(创建一个JSON数组建造者)
      Returns:
          a JSON array builder(一个JSON数组建造者)
      
    * public static JsonObjectBuilder createObjectBuilder()
      Creates a JSON object builder(创建一个JSON对象建造者)
      Returns:
          a JSON object builder(一个JSON对象建造者)
      
    * public static JsonBuilderFactory createBuilderFactory(Map config)
      Creates a builder factory for creating JsonArrayBuilder and JsonObjectBuilder objects. The factory is configured with the specified
      map of provider specific configuration properties. Provider implementations should ignore any unsupported configuration properties
      specified in the map.(建一个能够创建JsonArrayBuilder和JsonObjectBuilder实例的建造者工厂,该工厂被包含provider指定的配置项的特定map所配
      置。
provider的实现应当忽略map中的任何一个不支持的配置项)

      Parameters:
          config - a map of provider specific properties to configure the JSON builders. The map may be empty or null(一个包含provider指定
                   的配置项用于配置JSON建造者的map,该map可能是空或null)

      Returns:
          a JSON builder factory(一个JSON建造者工厂)





囿于译者水平有限,文中难免存在不妥之处,敬请谅解!!
阅读(4170) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~