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, anistor@redhat.com
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceFileDescriptorSource.ProgressCallbackA 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 FileDescriptorSourceaddProtoFile(String name, File protoFile)Add a proto file, given a name and the file contents as aFile.FileDescriptorSourceaddProtoFile(String name, InputStream fileContents)Add a proto file, given a name and the file contents as anInputStream.FileDescriptorSourceaddProtoFile(String name, Reader fileContents)Add a proto file, given a name and the file contents as aReader.FileDescriptorSourceaddProtoFile(String name, String fileContents)Add a proto file, given a name and the file contents as aString.FileDescriptorSourceaddProtoFiles(ClassLoader userClassLoader, String... classpathResources)Add proto files from class path.FileDescriptorSourceaddProtoFiles(String... classpathResources)Add proto files from class path.static FileDescriptorSourcefromResources(ClassLoader userClassLoader, String... classPathResources)static FileDescriptorSourcefromResources(String... classPathResources)static FileDescriptorSourcefromString(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.ProgressCallbackgetProgressCallback()static StringgetResourceAsString(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.FileDescriptorSourcewithProgressCallback(FileDescriptorSource.ProgressCallback progressCallback)Set the ProgressCallback.
-
-
-
Method Detail
-
withProgressCallback
public FileDescriptorSource withProgressCallback(FileDescriptorSource.ProgressCallback progressCallback)
Set the ProgressCallback. Anullcallback 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
-
-