Package org.infinispan.protostream
Class FileDescriptorSource
- java.lang.Object
-
- org.infinispan.protostream.FileDescriptorSource
-
public final class FileDescriptorSource extends Object
Aggregator for source proto files to be passed toSerializationContext.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
Nested Classes Modifier and Type Class Description static interface
FileDescriptorSource.ProgressCallback
A callback interface that receives status notifications during the processing of files defined by aFileDescriptorSource
.
-
Constructor Summary
Constructors Constructor Description FileDescriptorSource()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description FileDescriptorSource
addProtoFile(String name, File protoFile)
Add a proto file, given a name and the file contents as aFile
.FileDescriptorSource
addProtoFile(String name, InputStream fileContents)
Add a proto file, given a name and the file contents as anInputStream
.FileDescriptorSource
addProtoFile(String name, Reader fileContents)
Add a proto file, given a name and the file contents as aReader
.FileDescriptorSource
addProtoFile(String name, String fileContents)
Add a proto file, given a name and the file contents as aString
.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.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.
-
-
-
Method Detail
-
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
public FileDescriptorSource addProtoFiles(String... classpathResources) throws IOException
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
public FileDescriptorSource addProtoFile(String name, String fileContents)
Add a proto file, given a name and the file contents as aString
.
-
addProtoFile
public FileDescriptorSource addProtoFile(String name, InputStream fileContents) throws IOException
Add a proto file, given a name and the file contents as anInputStream
.- Throws:
IOException
-
addProtoFile
public FileDescriptorSource addProtoFile(String name, Reader fileContents) throws IOException
Add a proto file, given a name and the file contents as aReader
.- Throws:
IOException
-
addProtoFile
public FileDescriptorSource addProtoFile(String name, File protoFile) throws IOException
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
public static FileDescriptorSource fromResources(String... classPathResources) throws IOException
- Throws:
IOException
-
fromString
public static FileDescriptorSource fromString(String name, String fileContents)
-
getFileDescriptors
@Deprecated public 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 bygetFiles()
-
getProgressCallback
public FileDescriptorSource.ProgressCallback 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
-
-