public final class FileDescriptorSource extends Object
SerializationContext.registerProtoFiles(FileDescriptorSource).
The files are guaranteed to be processed in the order they were added (for better predictability or error reporting).| Modifier and Type | Class and Description |
|---|---|
static interface |
FileDescriptorSource.ProgressCallback
A callback interface that receives status notifications during the processing of files defined by a
FileDescriptorSource. |
| Constructor and Description |
|---|
FileDescriptorSource() |
| Modifier and Type | Method and Description |
|---|---|
FileDescriptorSource |
addProtoFile(String name,
File protoFile)
Add a proto file, given a name and the file contents as a
File. |
FileDescriptorSource |
addProtoFile(String name,
InputStream fileContents)
Add a proto file, given a name and the file contents as an
InputStream. |
FileDescriptorSource |
addProtoFile(String name,
Reader fileContents)
Add a proto file, given a name and the file contents as a
Reader. |
FileDescriptorSource |
addProtoFile(String name,
String fileContents)
Add a proto file, given a name and the file contents as a
String. |
FileDescriptorSource |
addProtoFiles(ClassLoader userClassLoader,
String... classpathResources)
Add proto files from class path.
|
FileDescriptorSource |
addProtoFiles(String... classpathResources)
Add proto files from class path.
|
static FileDescriptorSource |
fromResources(ClassLoader userClassLoader,
String... classPathResources) |
static FileDescriptorSource |
fromResources(String... classPathResources) |
static FileDescriptorSource |
fromString(String name,
String fileContents) |
Map<String,char[]> |
getFileDescriptors()
Deprecated.
This method was added for internal use and is deprecated since 4.3.4 to be removed in 5.
Replaced by
getFiles() |
Map<String,String> |
getFiles() |
FileDescriptorSource.ProgressCallback |
getProgressCallback() |
static String |
getResourceAsString(Class<?> c,
String resourcePath)
Deprecated.
This method is strictly for internal use and has been deprecated in 4.3.4 to prevent use from external
projects as it is subject for removal in 5.
|
FileDescriptorSource |
withProgressCallback(FileDescriptorSource.ProgressCallback progressCallback)
Set the ProgressCallback.
|
public FileDescriptorSource withProgressCallback(FileDescriptorSource.ProgressCallback progressCallback)
null callback indicates that errors are to be reported immediately and the
parsing operation should be aborted on first error.progressCallback - the callback, can be nullpublic FileDescriptorSource addProtoFiles(String... classpathResources) throws IOException
IOExceptionpublic FileDescriptorSource addProtoFiles(ClassLoader userClassLoader, String... classpathResources) throws IOException
IOExceptionpublic FileDescriptorSource addProtoFile(String name, String fileContents)
String.public FileDescriptorSource addProtoFile(String name, InputStream fileContents) throws IOException
InputStream.IOExceptionpublic FileDescriptorSource addProtoFile(String name, Reader fileContents) throws IOException
Reader.IOExceptionpublic FileDescriptorSource addProtoFile(String name, File protoFile) throws IOException
File.IOExceptionpublic static FileDescriptorSource fromResources(ClassLoader userClassLoader, String... classPathResources) throws IOException
IOExceptionpublic static FileDescriptorSource fromResources(String... classPathResources) throws IOException
IOExceptionpublic static FileDescriptorSource fromString(String name, String fileContents)
@Deprecated public Map<String,char[]> getFileDescriptors()
getFiles()public FileDescriptorSource.ProgressCallback getProgressCallback()
@Deprecated public static String getResourceAsString(Class<?> c, String resourcePath) throws UncheckedIOException
UncheckedIOException - if the resource is not found or an I/O error occursCopyright © 2021 JBoss, a division of Red Hat. All rights reserved.