-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail;
-import org.ibex.util.*;
-import org.ibex.io.*;
-import org.ibex.mail.target.*;
-import org.ibex.mail.protocol.*;
-import java.util.*;
-import java.io.*;
-import com.skaringa.javaxml.*;
-import javax.xml.transform.stream.*;
-
-public class SkaringaFile {
-
- //private transient File file;
- //private transient String path;
- //private transient boolean exists;
- private static WeakHashMap cache = new WeakHashMap();
-
- /*
- public void delete() throws IOException {
- exists = false;
- cache.remove(path, this);
- file.delete();
- }
- */
-
- public static Object read(File file) throws Exception {
- FileInputStream in = null;
- try {
- ObjectTransformer trans = ObjectTransformerFactory.getInstance().getImplementation();
- in = new FileInputStream(file);
- return trans.deserialize(new StreamSource(in));
- } finally {
- if (in!=null) in.close();
- }
- }
-
- public void write(File file) throws Exception {
- ObjectTransformer trans = ObjectTransformerFactory.getInstance().getImplementation();
- trans.setProperty(javax.xml.transform.OutputKeys.INDENT, "yes");
- trans.setProperty("{http://xml.apache.org/xalan}indent-amount", "2");
- FileOutputStream out = new FileOutputStream(file);
- trans.serialize(this, new StreamResult(out));
- out.close();
- // FIXME: sync
- // FIXME: write-aside
- }
-
-}