| 1 | |
package org.webslinger.commons.vfs.flat.tests; |
| 2 | |
|
| 3 | |
import java.io.File; |
| 4 | |
import java.io.IOException; |
| 5 | |
|
| 6 | |
import org.webslinger.io.IOUtil; |
| 7 | |
|
| 8 | 0 | public class TestUtil extends org.webslinger.commons.vfs.tests.TestUtil { |
| 9 | |
public static File getAttributeFile(File file) { |
| 10 | 4 | return new File(file.getParentFile(), file.getName() + "@"); |
| 11 | |
} |
| 12 | |
|
| 13 | |
public static File getAttributeFile(File file, String name) { |
| 14 | 36 | return new File(new File(file.getParentFile(), file.getName() + "@"), name); |
| 15 | |
} |
| 16 | |
|
| 17 | |
public static void setAttribute(File file, String name, Object value) throws IOException { |
| 18 | 0 | IOUtil.writeObjectToFile(getAttributeFile(file, name), value); |
| 19 | 0 | } |
| 20 | |
|
| 21 | |
public static Object getAttribute(File file, String name) throws ClassNotFoundException, IOException { |
| 22 | 0 | return IOUtil.readObjectFromFile(getAttributeFile(file, name)); |
| 23 | |
} |
| 24 | |
|
| 25 | |
public static void removeAttribute(File file, String name) throws IOException { |
| 26 | 0 | getAttributeFile(file, name).delete(); |
| 27 | 0 | } |
| 28 | |
} |