A policy for line endings which can vary based on the specific file being requested.
| 77 | |
| 78 | /** A policy for line endings which can vary based on the specific file being requested. */ |
| 79 | public interface Policy { |
| 80 | /** Returns the line ending appropriate for the given file. */ |
| 81 | String getEndingFor(File file); |
| 82 | |
| 83 | /** Returns true iff this file has unix line endings. */ |
| 84 | default boolean isUnix(File file) { |
| 85 | String ending = getEndingFor(file); |
| 86 | return ending.equals(UNIX.str()); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | /** Returns a string with exclusively unix line endings. */ |
| 91 | public static String toUnix(String input) { |
no outgoing calls
no test coverage detected