Class CatCommandBuilder

java.lang.Object
sonia.scm.repository.api.CatCommandBuilder

public final class CatCommandBuilder extends Object
Shows the content of a file in the Repository.

Sample:

Print the content of the file core/pom.xml from revision 46a23689ac91:

 CatCommandBuilder cat = repositoryService.getCatCommand();
 String content = cat.setRevision("46a23689ac91").getContent("core/pom.xml");
 System.out.println(content);
 
Since:
1.17
  • Method Details

    • reset

      public CatCommandBuilder reset()
      Reset each parameter to its default value.
      Returns:
      this
    • retriveContent

      public void retriveContent(OutputStream outputStream, String path) throws IOException
      Passes the content of the given file to the output stream.
      Parameters:
      outputStream - output stream for the content
      path - file path
      Throws:
      IOException
    • getStream

      public InputStream getStream(String path) throws IOException
      Returns an output stream with the file content.
      Parameters:
      path - file path
      Throws:
      IOException
    • getContent

      public String getContent(String path) throws IOException
      Returns the content of the given file.
      Throws:
      IOException
    • setRevision

      public CatCommandBuilder setRevision(String revision)
      Sets the revision of the file.
      Returns:
      this