Class PathWritableResource
java.lang.Object
org.apache.maven.index.reader.resource.PathWritableResource
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ResourceHandler.Resource
,WritableResourceHandler.WritableResource
public class PathWritableResource
extends Object
implements WritableResourceHandler.WritableResource
A
WritableResourceHandler.WritableResource
that represents a Path
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Default close method is no-op, override if implementation requires.read()
Returns theInputStream
stream of the resource, if exists,null
otherwise.write()
Returns theOutputStream
stream of the resource, if exists, it will replace the existing content, or if not exists, the resource will be created.
-
Constructor Details
-
PathWritableResource
-
-
Method Details
-
write
Description copied from interface:WritableResourceHandler.WritableResource
Returns theOutputStream
stream of the resource, if exists, it will replace the existing content, or if not exists, the resource will be created. The stream should be closed by caller, otherwise resource leaks might be introduced. How and when content is written is left to implementation, but it is guaranteed that this method is called only once, and will be followed byResourceHandler.Resource.close()
on the resource itself. Implementation does not have to be "read consistent", in a way to worry what subsequentResourceHandler.Resource.read()
method will return, as mixed calls will not happen on same instance of resource.- Specified by:
write
in interfaceWritableResourceHandler.WritableResource
- Throws:
IOException
-
read
Description copied from interface:ResourceHandler.Resource
Returns theInputStream
stream of the resource, if exists,null
otherwise. The stream should be closed by caller, otherwise resource leaks might be introduced.- Specified by:
read
in interfaceResourceHandler.Resource
- Throws:
IOException
-
close
Description copied from interface:ResourceHandler.Resource
Default close method is no-op, override if implementation requires.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceResourceHandler.Resource
- Throws:
IOException
-