Package org.infinispan.protostream
Class FileDescriptorSource
java.lang.Object
org.infinispan.protostream.FileDescriptorSource
Aggregator for source proto files to be passed to
SerializationContext.registerProtoFiles(FileDescriptorSource)
.
The files are guaranteed to be processed in the order they were added (for better predictability or error reporting).- Since:
- 2.0
- Author:
- gustavonalle, [email protected]
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
A callback interface that receives status notifications during the processing of files defined by aFileDescriptorSource
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddProtoFile
(String name, File protoFile) Add a proto file, given a name and the file contents as aFile
.addProtoFile
(String name, InputStream fileContents) Add a proto file, given a name and the file contents as anInputStream
.addProtoFile
(String name, Reader fileContents) Add a proto file, given a name and the file contents as aReader
.addProtoFile
(String name, String fileContents) Add a proto file, given a name and the file contents as aString
.addProtoFiles
(ClassLoader userClassLoader, String... classpathResources) Add proto files from class path.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) Deprecated.This method was added for internal use and is deprecated since 4.3.4 to be removed in 5.getFiles()
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.withProgressCallback
(FileDescriptorSource.ProgressCallback progressCallback) Set the ProgressCallback.
-
Constructor Details
-
FileDescriptorSource
public FileDescriptorSource()
-
-
Method Details
-
withProgressCallback
public FileDescriptorSource withProgressCallback(FileDescriptorSource.ProgressCallback progressCallback) Set the ProgressCallback. Anull
callback indicates that errors are to be reported immediately and the parsing operation should be aborted on first error.- Parameters:
progressCallback
- the callback, can benull
- Returns:
- this object, for easy method chaining
-
addProtoFiles
Add proto files from class path. The resource names are expected to be absolute.- Throws:
IOException
-
addProtoFiles
public FileDescriptorSource addProtoFiles(ClassLoader userClassLoader, String... classpathResources) throws IOException Add proto files from class path. The resource names are expected to be absolute.- Throws:
IOException
-
addProtoFile
Add a proto file, given a name and the file contents as aString
. -
addProtoFile
Add a proto file, given a name and the file contents as anInputStream
.- Throws:
IOException
-
addProtoFile
Add a proto file, given a name and the file contents as aReader
.- Throws:
IOException
-
addProtoFile
Add a proto file, given a name and the file contents as aFile
.- Throws:
IOException
-
fromResources
public static FileDescriptorSource fromResources(ClassLoader userClassLoader, String... classPathResources) throws IOException - Throws:
IOException
-
fromResources
- Throws:
IOException
-
fromString
-
getFileDescriptors
Deprecated.This method was added for internal use and is deprecated since 4.3.4 to be removed in 5. Replaced bygetFiles()
-
getFiles
-
getProgressCallback
-
getResourceAsString
@Deprecated public static String getResourceAsString(Class<?> c, String resourcePath) throws UncheckedIOException 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.- Throws:
UncheckedIOException
- if the resource is not found or an I/O error occurs
-