FileAccess.
| 34 | * |
| 35 | */ |
| 36 | public final class FileAccess |
| 37 | { |
| 38 | private static OutputFilter outputFilter = null; |
| 39 | private static int maxLength = -1; |
| 40 | |
| 41 | private FileAccess() |
| 42 | { |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Filter the supplied string according to the current output filter. This |
| 47 | * can do things such as escaping HTML entities. |
| 48 | * |
| 49 | * @param aString The string to be filtered |
| 50 | * @return The filtered string. |
| 51 | */ |
| 52 | public static String filterString(String aString) |
| 53 | { |
| 54 | String outputString = aString; |
| 55 | if (outputFilter != null) |
| 56 | { |
| 57 | outputString = outputFilter.filterString(aString); |
| 58 | } |
| 59 | return outputString; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Set the current output filter. The current output filter will be |
| 64 | * chosen based on the extension of the passed in template file name. |
| 65 | * |
| 66 | * @param templateFilename (used to create instance of CharacterFilter) |
| 67 | */ |
| 68 | public static void setCurrentOutputFilter(String templateFilename) |
| 69 | { |
| 70 | try |
| 71 | { |
| 72 | outputFilter = new PatternFilter(templateFilename); |
| 73 | } |
| 74 | catch (IOException e) |
| 75 | { |
| 76 | outputFilter = new CharacterFilter(templateFilename); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Set the current output filter |
| 82 | * @param filter |
| 83 | */ |
| 84 | public static void setCurrentOutputFilter(OutputFilter filter) |
| 85 | { |
| 86 | outputFilter = filter; |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Write, but with encoding |
| 91 | * @param output |
| 92 | * @param aString |
| 93 | */ |
nothing calls this directly
no outgoing calls
no test coverage detected