Class PrintDelegator

    • Constructor Detail

      • PrintDelegator

        public PrintDelegator​(IOptionsServer server)
        Instantiate a new PrintDelegator, providing the server object that will be used to execute Perforce Helix attribute commands.
        Parameters:
        server - a concrete implementation of a Perforce Helix Server
    • Method Detail

      • getFileContents

        public java.io.InputStream getFileContents​(java.util.List<IFileSpec> fileSpecs,
                                                   GetFileContentsOptions opts)
                                            throws P4JavaException
        Description copied from interface: IPrintDelegator
        Return an InputStream onto the contents of one or more revisions of one or more Perforce depot file contents.

        If file is specified as a Perforce client workspace file name, the client view is used to find the corresponding depot file. If a file argument has a revision, then all files as of that revision are streamed. If a file argument has a revision range, then only files selected by that revision range are streamed, and the highest revision in the range is used for each file. Normally, only the head revision is printed.

        The underlying input stream is not guaranteed to support mark() and skip() operations, and in some cases can be absolutely ginormously long it is also not guaranteed to be printable, and will be in the charset encoding stored in the Perforce server.

        You should close the InputStreamReader after use in order to release any underlying stream-related resources. Failure to do this may lead to the proliferation of temp files or long-term memory wastage or even leaks.

        Note that unlike the corresponding command-line command, which keeps going in the face of errors by moving on to the next file (or whatever), any errors encountered in this method will cause an exception from this method at the first error, so plan accordingly....

        Specified by:
        getFileContents in interface IPrintDelegator
        Parameters:
        fileSpecs - non-null list of depot or client file specs defining files to be streamed
        opts - GetFileContentsOptions object describing optional parameters; if null, no options are set.
        Returns:
        a non-null but possibly-empty InputStream onto the file / revision contents.
        Throws:
        P4JavaException - if any error occurs in the processing of this method.
      • getFileContents

        public void getFileContents​(java.nio.ByteBuffer byteBufferContent,
                                    java.util.List<IFileSpec> fileSpecs,
                                    GetFileContentsOptions opts)
                             throws java.lang.Exception
        Description copied from interface: IPrintDelegator
        Saves the value of a ByteBuffer onto the contents of one or more Perforce depot file contents.

        If file is specified as a Perforce client workspace file name, the client view is used to find the corresponding depot file.

        Note that unlike the corresponding command-line command, which keeps going in the face of errors by moving on to the next file (or whatever), any errors encountered in this method will cause an exception from this method at the first error, so plan accordingly....

        Specified by:
        getFileContents in interface IPrintDelegator
        Parameters:
        byteBufferContent - Fills with content of the fileSpecs into a ByteBuffer
        fileSpecs - non-null list of depot or client file specs defining files to be streamed
        opts - GetFileContentsOptions object describing optional parameters; if null, no options are set.
        Throws:
        P4JavaException - if any error occurs in the processing of this method.
        java.lang.Exception