public class Patch extends Object
FileHeaders from a unified diff patch file| Constructor and Description |
|---|
Patch()
Create an empty patch.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addError(FormatError err)
Add a formatting error to this patch script.
|
void |
addFile(FileHeader fh)
Add a single file to this patch.
|
List<FormatError> |
getErrors() |
List<? extends FileHeader> |
getFiles() |
void |
parse(byte[] buf,
int ptr,
int end)
Parse a patch stored in a byte[].
|
void |
parse(InputStream is)
Parse a patch received from an InputStream.
|
public void addFile(FileHeader fh)
Typically files should be added by parsing the text through one of this class's parse methods.
fh - the header of the file.public List<? extends FileHeader> getFiles()
public void addError(FormatError err)
err - the error description.public List<FormatError> getErrors()
public void parse(InputStream is) throws IOException
Multiple parse calls on the same instance will concatenate the patch data, but each parse input must start with a valid file header (don't split a single file across parse calls).
is - the stream to read the patch data from. The stream is read
until EOF is reached.IOException - there was an error reading from the input stream.public void parse(byte[] buf,
int ptr,
int end)
Multiple parse calls on the same instance will concatenate the patch data, but each parse input must start with a valid file header (don't split a single file across parse calls).
buf - the buffer to parse.ptr - starting position to parse from.end - 1 past the last position to end parsing. The total length to
be parsed is end - ptr.Copyright © 2014. All rights reserved.