Interface PatchBuilder
-
- All Known Implementing Classes:
AbstractPatchBuilder
,PatchBuilderAdapter
,PatchBuilderFileNamesCorrector
public interface PatchBuilder
This interface allows you to create information about files changed between two version.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
changeOrCreateBinaryFile(java.io.File file, java.lang.String fileMode, java.io.InputStream input, long length)
Invoke this method if some binary file content has been changed or binary file has been created in the next version as compared with the previous one.void
changeOrCreateTextFile(java.io.File localFile, java.lang.String fileMode, java.io.InputStream input, long length, byte[] lineSeparator)
Invoke this method if some text file content has been changed or text file has been created in the next version as compared with the previous one.void
createBinaryFile(java.io.File file, java.lang.String fileMode, java.io.InputStream input, long length)
Invoke this method if some binary file content has been created in the next version as compared with the previous one.void
createDirectory(java.io.File file)
Invoke this method if some directory has been created in the next version as compared with the previous one.void
createTextFile(java.io.File file, java.lang.String fileMode, java.io.InputStream input, long length, byte[] lineSeparator)
Invoke this method if some text file has been created in the next version as compared with the previous one.void
deleteDirectory(java.io.File file, boolean deleteParentDirectoryIfEmpty)
Invoke this method if some directory has been deleted in the next version as compared with the previous one.void
deleteFile(java.io.File file, boolean deleteParentDirectoryIfEmpty)
Invoke this method if some file has been deleted in the next version as compared with the previous one.void
renameDirectory(java.io.File oldDirectory, java.io.File newDirectory, boolean deleteParentDirectoryIfEmpty)
Invoke this method if some directory has been renamed in the next version as compared with the previous one.void
renameFile(java.io.File oldFile, java.io.File newFile, boolean deleteParentDirectoryIfEmpty)
Invoke this method if some file has been renamed in the next version as compared with the previous one.void
setLastModified(java.io.File currentRelativeFile, long time)
Set last modified timestamp for filevoid
setWorkingDirectory(java.io.File workingDir, boolean createDirectory)
Allows you to switch on to the specified directory keeping old content of this directory.
-
-
-
Method Detail
-
deleteFile
void deleteFile(@NotNull java.io.File file, boolean deleteParentDirectoryIfEmpty) throws java.io.IOException
Invoke this method if some file has been deleted in the next version as compared with the previous one.- Parameters:
file
- file relative to the current working directory.deleteParentDirectoryIfEmpty
- pass true if you want patcher to delete parent directory if it became empty after the deletion.- Throws:
java.io.IOException
- thrown if patch collecting process failed.
-
deleteDirectory
void deleteDirectory(@NotNull java.io.File file, boolean deleteParentDirectoryIfEmpty) throws java.io.IOException
Invoke this method if some directory has been deleted in the next version as compared with the previous one.- Parameters:
file
- directory relative to the current working directory.deleteParentDirectoryIfEmpty
- pass true if you want patcher to delete parent directory if it became empty after the deletion.- Throws:
java.io.IOException
- thrown if patch collecting process failed.
-
createDirectory
void createDirectory(@NotNull java.io.File file) throws java.io.IOException
Invoke this method if some directory has been created in the next version as compared with the previous one.- Parameters:
file
- file relative to the current working directory.- Throws:
java.io.IOException
- thrown if patch collecting process failed.
-
renameFile
void renameFile(@NotNull java.io.File oldFile, @NotNull java.io.File newFile, boolean deleteParentDirectoryIfEmpty) throws java.io.IOException
Invoke this method if some file has been renamed in the next version as compared with the previous one.- Parameters:
oldFile
- file relative to the current working directory.newFile
- new file locationdeleteParentDirectoryIfEmpty
- pass true if you want patcher to delete parent directory if it becomes empty after the deletion.- Throws:
java.io.IOException
- thrown if patch collecting process failed.
-
renameDirectory
void renameDirectory(@NotNull java.io.File oldDirectory, @NotNull java.io.File newDirectory, boolean deleteParentDirectoryIfEmpty) throws java.io.IOException
Invoke this method if some directory has been renamed in the next version as compared with the previous one.- Parameters:
oldDirectory
- directory relative to the current working directory.newDirectory
- new directory locationdeleteParentDirectoryIfEmpty
- pass true if you want patcher to delete parent directory if it becomes empty after the deletion. @throws IOException- Throws:
java.io.IOException
- thrown if patch collecting process failed.
-
setWorkingDirectory
void setWorkingDirectory(@NotNull java.io.File workingDir, boolean createDirectory) throws java.io.IOException
Allows you to switch on to the specified directory keeping old content of this directory.- Parameters:
workingDir
- new working directory. Path relative to the initial directory, not to the current one.createDirectory
- if directory should be created on file system if specified directory is absent.- Throws:
java.io.IOException
- thrown if patch collecting process failed.
-
setLastModified
void setLastModified(@NotNull java.io.File currentRelativeFile, long time) throws java.io.IOException
Set last modified timestamp for file- Parameters:
currentRelativeFile
- relative filetime
- last modified timestamp- Throws:
java.io.IOException
- in case of error
-
changeOrCreateTextFile
void changeOrCreateTextFile(@NotNull java.io.File localFile, @Nullable java.lang.String fileMode, @NotNull java.io.InputStream input, long length, @Nullable byte[] lineSeparator) throws java.io.IOException
Invoke this method if some text file content has been changed or text file has been created in the next version as compared with the previous one.- Parameters:
localFile
- file relative to the current working directoryfileMode
- file mode in the linux style. If it doesn't matter for you set it to null. Set this parameter to not null if its value changes something, for example, pass "ugo+x" if you want the file to be executable and null otherwise. It is performance issue because set file mode will create a lot of processes on the Linux.input
- input stream containing the file content. This stream is guaranteed to be utilized within the call. So it can be safely closed/destroyed right after the invocation.length
- length of the content.lineSeparator
- text content line separator. Set null if you want to use system dependant separators. Use "changeOrCreateBinaryFile" if you want file to keep existing separators.- Throws:
java.io.IOException
- thrown if patch collecting process failed.
-
changeOrCreateBinaryFile
void changeOrCreateBinaryFile(@NotNull java.io.File file, @Nullable java.lang.String fileMode, @NotNull java.io.InputStream input, long length) throws java.io.IOException
Invoke this method if some binary file content has been changed or binary file has been created in the next version as compared with the previous one. This method can be used for text file also if you want to keep existing line separators inside the file.- Parameters:
file
- file relative to the current working directory.fileMode
- file mode in the linux style. If it doesn't matter for you set it to null. Set this parameter to not null if its value changes something, for example, pass "ugo+x" if you want the file to be executable and null otherwise. It is performance issue because set file mode will create a lot of processes on the Linux.input
- input stream containing the file content. This stream is guaranteed to be utilized within the call. So it can be safely closed/destroyed right after the invocation.length
- length of the content.- Throws:
java.io.IOException
- thrown if patch collecting process failed.
-
createBinaryFile
void createBinaryFile(@NotNull java.io.File file, @Nullable java.lang.String fileMode, @NotNull java.io.InputStream input, long length) throws java.io.IOException
Invoke this method if some binary file content has been created in the next version as compared with the previous one. This method can be used for text file also if you want to keep existing line separators inside the file.- Parameters:
file
- file relative to the current working directory.fileMode
- file mode in the linux style. If it doesn't matter for you set it to null. Set this parameter to not null if its value changes something, for example, pass "ugo+x" if you want the file to be executable and null otherwise. It is performance issue because set file mode will create a lot of processes on the Linux.input
- input stream containing the file content. This stream is guaranteed to be utilized within the call. So it can be safely closed/destroyed right after the invocation.length
- length of the content.- Throws:
java.io.IOException
- thrown if patch collecting process failed.
-
createTextFile
void createTextFile(@NotNull java.io.File file, @Nullable java.lang.String fileMode, @NotNull java.io.InputStream input, long length, @Nullable byte[] lineSeparator) throws java.io.IOException
Invoke this method if some text file has been created in the next version as compared with the previous one.- Parameters:
file
- file relative to the current working directoryfileMode
- file mode in the linux style. If it doesn't matter for you set it to null. Set this parameter to not null if its value changes something, for example, pass "ugo+x" if you want the file to be executable and null otherwise. It is performance issue because set file mode will create a lot of processes on the Linux.input
- input stream containing the file content. This stream is guaranteed to be utilized within the call. So it can be safely closed/destroyed right after the invocation.length
- length of the content.lineSeparator
- text content line separator. Set null if you want to use system dependant separators. Use "createBinaryFile" if you want file to keep existing separators.- Throws:
java.io.IOException
- thrown if patch collecting process failed.
-
-