net.sf.statsvn.util

## Class SvnPropgetUtils

- java.lang.Object
- - net.sf.statsvn.util.SvnPropgetUtils

- All Implemented Interfaces:
    ISvnPropgetProcessor
  Direct Known Subclasses:
    SvnKitPropget

      public class SvnPropgetUtils
      extends java.lang.Object
      implements ISvnPropgetProcessor

  Utilities class that manages calls to svn propget. Used to find binary files.
  Version:
    $Id: SvnPropgetUtils.java 394 2009-08-10 20:08:46Z jkealey $
  Author:
    Jason Kealey

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.List` | `binaryFiles`
    `protected ISvnProcessor` | `processor`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SvnPropgetUtils(ISvnProcessor processor)` Invokes propget via the svn propget via the command line.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected java.lang.String` | `getBinaryFilename(java.lang.String currentLine, boolean removeRoot)` Given a string such as: "lib\junit.jar - application/octet-stream" or "svn:\\host\repo\lib\junit.jar - application/octet-stream" will return the filename if the mime type is binary (doesn't end with text/*) Will return the filename with / was a directory seperator.
    `java.util.List` | `getBinaryFiles()` Returns the list of binary files in the working directory.
    `protected ProcessUtils` | `getFileMimeTypes()` Get the svn:mime-types for all files, latest revision.
    `protected ProcessUtils` | `getFileMimeTypes(java.lang.String revision, java.lang.String filename)` Get the svn:mime-type for a certain file (leave null for all files).
    `protected ISvnProcessor` | `getProcessor()`
    `boolean` | `isBinaryFile(java.lang.String revision, java.lang.String filename)` It was first thought that a the mime-type of a file's previous revision could be found.
    `protected void` | `loadBinaryFiles(ProcessUtils pUtils)` Loads the list of binary files from the input stream equivalent to an svn propget command.
    `void` | `loadBinaryFiles(java.lang.String path)` Loads the list of binary files from the input stream equivalent to an svn propget command.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### binaryFiles

          protected java.util.List binaryFiles

    - #### processor

          protected ISvnProcessor processor

  - ### Constructor Detail

    - #### SvnPropgetUtils

          public SvnPropgetUtils(ISvnProcessor processor)

      Invokes propget via the svn propget via the command line.

  - ### Method Detail

    - #### getProcessor

          protected ISvnProcessor getProcessor()

    - #### getFileMimeTypes

          protected ProcessUtils getFileMimeTypes()

      Get the svn:mime-types for all files, latest revision.
      Returns:
        the inputstream from which to read the information.

    - #### getFileMimeTypes

          protected ProcessUtils getFileMimeTypes(java.lang.String revision,
                                      java.lang.String filename)

      Get the svn:mime-type for a certain file (leave null for all files).
      Parameters:
        `revision` - revision for which to query;
        `filename` - the filename (or null for all files)
      Returns:
        the inputstream from which to read the information.

    - #### getBinaryFiles

          public java.util.List getBinaryFiles()

      Description copied from interface: `ISvnPropgetProcessor`
      Returns the list of binary files in the working directory.
      Specified by:
        `getBinaryFiles` in interface `ISvnPropgetProcessor`
      Returns:
        the list of binary files

    - #### loadBinaryFiles

          public void loadBinaryFiles(java.lang.String path)
                               throws java.io.IOException

      Loads the list of binary files from the input stream equivalent to an svn propget command.
      Specified by:
        `loadBinaryFiles` in interface `ISvnPropgetProcessor`
      Parameters:
        `path` - a file on disk which contains the results of an svn propget
      Throws:
        `java.io.IOException`

    - #### loadBinaryFiles

          protected void loadBinaryFiles(ProcessUtils pUtils)

      Loads the list of binary files from the input stream equivalent to an svn propget command.
      Parameters:
        `stream` - stream equivalent to an svn propget command

    - #### isBinaryFile

          public boolean isBinaryFile(java.lang.String revision,
                             java.lang.String filename)

      Description copied from interface: `ISvnPropgetProcessor`
      It was first thought that a the mime-type of a file's previous revision could be found. This is not the case. Leave revision null until future upgrade of svn propget command line.
      Specified by:
        `isBinaryFile` in interface `ISvnPropgetProcessor`
      Parameters:
        `revision` - the revision to query
        `filename` - the filename
      Returns:
        if that version of a file is binary

    - #### getBinaryFilename

          protected java.lang.String getBinaryFilename(java.lang.String currentLine,
                                           boolean removeRoot)

      Given a string such as: "lib\junit.jar - application/octet-stream" or "svn:\\host\repo\lib\junit.jar - application/octet-stream" will return the filename if the mime type is binary (doesn't end with text/*) Will return the filename with / was a directory seperator.
      Parameters:
        `currentLine` - the line obtained from svn propget svn:mime-type
        `removeRoot` - if true, will remove any repository prefix
      Returns:
        should return lib\junit.jar in both cases, given that removeRoot==true in the second case.