-
- All Known Subinterfaces:
JsonValidationService
public interface JsonSchemaReaderFactoryA factory interface for creatingJsonSchemaReaderinstances.The following code sample shows how to read a JSON schema from a string:
JsonValidationService service = JsonValidationService.newInstance(); JsonSchemaReaderFactory factory = service.createSchemaReaderFactory(); StringReader reader = new StringReader("{\"type\": \"integer\"}"); try (JsonSchemaReader reader = factory.createSchemaReader(reader)) { JsonSchema schema = reader.read(); }Any instance of this class is safe for use by multiple concurrent threads.
- Author:
- leadpony
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description JsonSchemaReadercreateSchemaReader(InputStream in)Creates a JSON schema reader from a byte stream.JsonSchemaReadercreateSchemaReader(InputStream in, Charset charset)Creates a JSON schema reader from a byte stream encoded by the specified charset.JsonSchemaReadercreateSchemaReader(Reader reader)Creates a JSON schema reader from a character stream.JsonSchemaReadercreateSchemaReader(Path path)Creates a JSON schema reader from a path.
-
-
-
Method Detail
-
createSchemaReader
JsonSchemaReader createSchemaReader(InputStream in)
Creates a JSON schema reader from a byte stream. The character encoding of the stream is determined as described in RFC 7159.- Parameters:
in- the byte stream from which a JSON schema is to be read.- Returns:
- newly created instance of JSON schema reader. It must be closed by the method caller after use.
- Throws:
NullPointerException- if the specifiedinisnull.- See Also:
JsonSchemaReader
-
createSchemaReader
JsonSchemaReader createSchemaReader(InputStream in, Charset charset)
Creates a JSON schema reader from a byte stream encoded by the specified charset. The bytes of the stream will be decoded to characters using the specified charset.- Parameters:
in- the byte stream from which a JSON schema is to be read.charset- the character set.- Returns:
- newly created instance of JSON schema reader. It must be closed by the method caller after use.
- Throws:
NullPointerException- if the specifiedinorcharsetisnull.- See Also:
JsonSchemaReader
-
createSchemaReader
JsonSchemaReader createSchemaReader(Reader reader)
Creates a JSON schema reader from a character stream.- Parameters:
reader- the character stream from which a JSON schema is to be read.- Returns:
- newly created instance of JSON schema reader. It must be closed by the method caller after use.
- Throws:
NullPointerException- if the specifiedreaderisnull.- See Also:
JsonSchemaReader
-
createSchemaReader
JsonSchemaReader createSchemaReader(Path path)
Creates a JSON schema reader from a path.- Parameters:
path- the path from which a JSON schema is to be read.- Returns:
- newly created instance of JSON schema reader. It must be closed by the method caller after use.
- Throws:
JsonException- if an I/O error occurs while creating reader.NullPointerException- if the specifiedpathisnull.- See Also:
JsonSchemaReader
-
-