Class PatchBuilderImpl
- java.lang.Object
-
- jetbrains.buildServer.vcs.AbstractPatchBuilder
-
- jetbrains.buildServer.vcs.patches.PatchBuilderImpl
-
- All Implemented Interfaces:
Closeable,AutoCloseable,PatchBuilder,PatchBuilderEx
public class PatchBuilderImpl extends AbstractPatchBuilder implements PatchBuilderEx
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPatchBuilderImpl.StreamWriteFileContentstatic classPatchBuilderImpl.StreamWriteFileContentWithExtensions
-
Constructor Summary
Constructors Constructor Description PatchBuilderImpl(OutputStream output)PatchBuilderImpl(LowLevelPatchBuilder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchangeOrCreateBinaryFile(File localFile, String fileMode, 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.voidchangeOrCreateTextFile(File localFile, String fileMode, 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.voidclose()voidcreateBinaryFile(File localFile, String fileMode, 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.static PatchBuilderImpl.StreamWriteFileContentcreateContent(InputStream input, long length)voidcreateDirectory(File localFile)Invoke this method if some directory has been created in the next version as compared with the previous one.voidcreateTextFile(File localFile, String fileMode, 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.voiddeleteDirectory(File file, boolean deleteParentDirectoryIfEmpty)Invoke this method if some directory has been deleted in the next version as compared with the previous one.voiddeleteFile(File file, boolean deleteParentDirectoryIfEmpty)Invoke this method if some file has been deleted in the next version as compared with the previous one.voidfail(String errorMessage)voidflush()LowLevelPatchBuildergetLowLevelBuilder()voidinterrupt()booleanisInterrupted()voidrenameDirectory(File file, File newFile, boolean deleteParentDirectoryIfEmpty)Invoke this method if some directory has been renamed in the next version as compared with the previous one.voidrenameFile(File file, File newFile, boolean deleteParentDirectoryIfEmpty)Invoke this method if some file has been renamed in the next version as compared with the previous one.voidsetLastModified(File localFile, long time)Set last modified timestamp for file-
Methods inherited from class jetbrains.buildServer.vcs.AbstractPatchBuilder
getPathInCurrentWorkingDirectory, setWorkingDirectory
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.vcs.patches.PatchBuilder
setWorkingDirectory
-
-
-
-
Constructor Detail
-
PatchBuilderImpl
public PatchBuilderImpl(@NotNull OutputStream output)
-
PatchBuilderImpl
public PatchBuilderImpl(@NotNull LowLevelPatchBuilder builder)
-
-
Method Detail
-
changeOrCreateTextFile
public void changeOrCreateTextFile(@NotNull File localFile, String fileMode, @NotNull InputStream input, long length, byte[] lineSeparator) throws IOExceptionDescription copied from interface:PatchBuilderInvoke 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.- Specified by:
changeOrCreateTextFilein interfacePatchBuilder- 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:
IOException- thrown if patch collecting process failed.
-
createTextFile
public void createTextFile(@NotNull File localFile, String fileMode, @NotNull InputStream input, long length, byte[] lineSeparator) throws IOExceptionDescription copied from interface:PatchBuilderInvoke this method if some text file has been created in the next version as compared with the previous one.- Specified by:
createTextFilein interfacePatchBuilder- 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 "createBinaryFile" if you want file to keep existing separators.- Throws:
IOException- thrown if patch collecting process failed.
-
setLastModified
public void setLastModified(@NotNull File localFile, long time) throws IOExceptionDescription copied from interface:PatchBuilderSet last modified timestamp for file- Specified by:
setLastModifiedin interfacePatchBuilder- Parameters:
localFile- relative filetime- last modified timestamp- Throws:
IOException- in case of error
-
isInterrupted
public boolean isInterrupted()
-
getLowLevelBuilder
@NotNull public LowLevelPatchBuilder getLowLevelBuilder()
- Specified by:
getLowLevelBuilderin interfacePatchBuilderEx
-
renameFile
public void renameFile(@NotNull File file, @NotNull File newFile, boolean deleteParentDirectoryIfEmpty) throws IOExceptionDescription copied from interface:PatchBuilderInvoke this method if some file has been renamed in the next version as compared with the previous one.- Specified by:
renameFilein interfacePatchBuilder- Parameters:
file- 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:
IOException- thrown if patch collecting process failed.
-
renameDirectory
public void renameDirectory(@NotNull File file, @NotNull File newFile, boolean deleteParentDirectoryIfEmpty) throws IOExceptionDescription copied from interface:PatchBuilderInvoke this method if some directory has been renamed in the next version as compared with the previous one.- Specified by:
renameDirectoryin interfacePatchBuilder- Parameters:
file- directory relative to the current working directory.newFile- new directory locationdeleteParentDirectoryIfEmpty- pass true if you want patcher to delete parent directory if it becomes empty after the deletion. @throws IOException- Throws:
IOException- thrown if patch collecting process failed.
-
deleteFile
public void deleteFile(@NotNull File file, boolean deleteParentDirectoryIfEmpty) throws IOExceptionDescription copied from interface:PatchBuilderInvoke this method if some file has been deleted in the next version as compared with the previous one.- Specified by:
deleteFilein interfacePatchBuilder- 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:
IOException- thrown if patch collecting process failed.
-
deleteDirectory
public void deleteDirectory(@NotNull File file, boolean deleteParentDirectoryIfEmpty) throws IOExceptionDescription copied from interface:PatchBuilderInvoke this method if some directory has been deleted in the next version as compared with the previous one.- Specified by:
deleteDirectoryin interfacePatchBuilder- 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:
IOException- thrown if patch collecting process failed.
-
changeOrCreateBinaryFile
public void changeOrCreateBinaryFile(@NotNull File localFile, String fileMode, @NotNull InputStream input, long length) throws IOExceptionDescription copied from interface:PatchBuilderInvoke 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.- Specified by:
changeOrCreateBinaryFilein interfacePatchBuilder- Parameters:
localFile- 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:
IOException- thrown if patch collecting process failed.
-
createBinaryFile
public void createBinaryFile(@NotNull File localFile, String fileMode, @NotNull InputStream input, long length) throws IOExceptionDescription copied from interface:PatchBuilderInvoke 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.- Specified by:
createBinaryFilein interfacePatchBuilder- Parameters:
localFile- 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:
IOException- thrown if patch collecting process failed.
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
fail
public void fail(@NotNull String errorMessage) throws IOException- Specified by:
failin interfacePatchBuilderEx- Throws:
IOException
-
createDirectory
public void createDirectory(@NotNull File localFile) throws IOExceptionDescription copied from interface:PatchBuilderInvoke this method if some directory has been created in the next version as compared with the previous one.- Specified by:
createDirectoryin interfacePatchBuilder- Parameters:
localFile- file relative to the current working directory.- Throws:
IOException- thrown if patch collecting process failed.
-
interrupt
public void interrupt() throws IOException- Throws:
IOException
-
flush
public void flush() throws IOException- Throws:
IOException
-
createContent
@NotNull public static PatchBuilderImpl.StreamWriteFileContent createContent(@NotNull InputStream input, long length)
-
-