Top Description Fields Constructors Methods
com.fasterxml.jackson.dataformat.protobuf.schema

public Class ProtobufSchemaLoader

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.*, java.net.URL, java.nio.charset.Charset, com.squareup.protoparser.ProtoFile, .ProtoParser

Class used for loading protobuf definitions (from .proto files or equivalent sources), to construct schema needed for reading or writing content.

Note that message name argument is optional if (and only if) desired root type is the first Message type in definition; otherwise an exception will be thrown.

Field Summary

Modifier and TypeField and Description
public static final String
private static final long
public static final ProtobufSchemaLoader
std

Standard loader instance that is usually used for loading protoc schemas.

private static final Charset

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ProtoFile
public ProtoFile
public ProtoFile
_loadNative(String schemaAsString)

public ProtoFile
_loadNative(InputStream in, boolean close)

protected ProtoFile
_loadNative(Reader r, boolean close)

protected String
public ProtobufSchema
load(URL url)

public ProtobufSchema
load(URL url, String
Name of message type in schema definition that is the root value to read/write
rootTypeName
)

public ProtobufSchema
public ProtobufSchema
load(File f, String
Name of message type in schema definition that is the root value to read/write
rootTypeName
)

public ProtobufSchema
load(InputStream in)

Method for loading and parsing a protoc definition from given stream, assuming UTF-8 encoding.

public ProtobufSchema
load(InputStream in, String
Name of message type in schema definition that is the root value to read/write
rootTypeName
)

public ProtobufSchema
load(Reader r)

Method for loading and parsing a protoc definition from given stream, assuming UTF-8 encoding.

public ProtobufSchema
load(Reader r, String
Name of message type in schema definition that is the root value to read/write
rootTypeName
)

public NativeProtobufSchema
public NativeProtobufSchema
public NativeProtobufSchema
loadNative(InputStream in, boolean close)

protected NativeProtobufSchema
loadNative(Reader r, boolean close)

public ProtobufSchema
parse(String schemaAsString)

Method for parsing given protoc schema definition, constructing schema object Jackson can use.

public ProtobufSchema
parse(String schemaAsString, String
Name of message type in schema definition that is the root value to read/write
rootTypeName
)

public NativeProtobufSchema
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_SCHEMA_NAMEback to summary
public static final String DEFAULT_SCHEMA_NAME
serialVersionUIDback to summary
private static final long serialVersionUID
stdback to summary
public static final ProtobufSchemaLoader std

Standard loader instance that is usually used for loading protoc schemas.

UTF8back to summary
private static final Charset UTF8

Constructor Detail

ProtobufSchemaLoaderback to summary
public ProtobufSchemaLoader()

Method Detail

_loadNativeback to summary
public ProtoFile _loadNative(File f) throws IOException
_loadNativeback to summary
public ProtoFile _loadNative(URL url) throws IOException
_loadNativeback to summary
public ProtoFile _loadNative(String schemaAsString) throws IOException
_loadNativeback to summary
public ProtoFile _loadNative(InputStream in, boolean close) throws IOException
_loadNativeback to summary
protected ProtoFile _loadNative(Reader r, boolean close) throws IOException
_readAllback to summary
protected String _readAll(Reader r) throws IOException
loadback to summary
public ProtobufSchema load(URL url) throws IOException
loadback to summary
public ProtobufSchema load(URL url, String rootTypeName) throws IOException
Parameters
rootTypeName:String

Name of message type in schema definition that is the root value to read/write

loadback to summary
public ProtobufSchema load(File f) throws IOException
loadback to summary
public ProtobufSchema load(File f, String rootTypeName) throws IOException
Parameters
rootTypeName:String

Name of message type in schema definition that is the root value to read/write

loadback to summary
public ProtobufSchema load(InputStream in) throws IOException

Method for loading and parsing a protoc definition from given stream, assuming UTF-8 encoding. Note that given InputStream will be closed before method returns.

loadback to summary
public ProtobufSchema load(InputStream in, String rootTypeName) throws IOException
Parameters
rootTypeName:String

Name of message type in schema definition that is the root value to read/write

loadback to summary
public ProtobufSchema load(Reader r) throws IOException

Method for loading and parsing a protoc definition from given stream, assuming UTF-8 encoding. Note that given Reader will be closed before method returns.

loadback to summary
public ProtobufSchema load(Reader r, String rootTypeName) throws IOException
Parameters
rootTypeName:String

Name of message type in schema definition that is the root value to read/write

loadNativeback to summary
public NativeProtobufSchema loadNative(File f) throws IOException
loadNativeback to summary
public NativeProtobufSchema loadNative(URL url) throws IOException
loadNativeback to summary
public NativeProtobufSchema loadNative(InputStream in, boolean close) throws IOException
loadNativeback to summary
protected NativeProtobufSchema loadNative(Reader r, boolean close) throws IOException
parseback to summary
public ProtobufSchema parse(String schemaAsString) throws IOException

Method for parsing given protoc schema definition, constructing schema object Jackson can use.

parseback to summary
public ProtobufSchema parse(String schemaAsString, String rootTypeName) throws IOException
Parameters
rootTypeName:String

Name of message type in schema definition that is the root value to read/write

parseNativeback to summary
public NativeProtobufSchema parseNative(String schema) throws IOException