Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I just tried. You can get the bytes of the file to be modified. Change the contents in memory. Last, check in the code. Here is the sniped:</p> <pre><code>byte[] in = checkOutPom(project+"/"+ destinationPathQualifier + tag+ "/pom.xml"); BufferedReader bin = new BufferedReader(new InputStreamReader( new ByteArrayInputStream(in))); MyPomHandler h = new MyPomHandler(); //replaces strings in the file ByteArrayOutputStream os = new ByteArrayOutputStream(); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter( os)); h.replace(bin, writer, "1.0.0-SNAPSHOT", tag); ISVNEditor editor = getRepository().getCommitEditor( "Patching POM with tag:"+tag, null); modifyFile(editor, project + "/" + destinationPathQualifier + tag, project + "/" + destinationPathQualifier + tag+"/pom.xml",in, os.toByteArray()); </code></pre> <p>===================================================</p> <pre><code>public byte[] checkOutPom(String filename) throws SVNException { SVNProperties fileProperties = new SVNProperties(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); getRepository().getFile(filename, -1, fileProperties, baos); return baos.toByteArray(); } </code></pre> <p>==================================================</p> <p>from svnkit sample code:</p> <pre><code>public SVNCommitInfo modifyFile(ISVNEditor editor, String dirPath, String filePath, byte[] oldData, byte[] newData) throws SVNException { editor.openRoot(-1); editor.openDir(dirPath, -1); editor.openFile(filePath, -1); editor.applyTextDelta(filePath, null); SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator(); String checksum = deltaGenerator.sendDelta(filePath, new ByteArrayInputStream(oldData), 0, new ByteArrayInputStream( newData), editor, true); editor.closeFile(filePath, checksum); editor.closeDir(); editor.closeDir(); return editor.closeEdit(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload