View Javadoc

1   /*
2    * Copyright (C) The MetaClass Group. All rights reserved.
3    *
4    * This software is published under the terms of the Spice
5    * Software License version 1.1, a copy of which has been included
6    * with this distribution in the LICENSE.txt file.
7    */
8   package org.codehaus.metaclass.io;
9   
10  import java.io.File;
11  import java.io.InputStream;
12  import org.codehaus.metaclass.model.ClassDescriptor;
13  
14  /***
15   * This is the interface used to read and write descriptors into Input and
16   * Output streams.
17   *
18   * @author Doug Hagan
19   * @version $Revision: 1.8 $ $Date: 2003/12/11 08:41:50 $
20   */
21  public interface MetaClassIO
22  {
23      /***
24       * Read a ClassDescriptor from an input stream.
25       *
26       * @param input the input stream
27       * @return the ClassDescriptor
28       * @throws Exception if unable ot read class descriptor
29       */
30      ClassDescriptor deserializeClass( InputStream input )
31          throws Exception;
32  
33      /***
34       * Get the name of resource the metadata is stored in for specified class.
35       *
36       * @param classname the name of class
37       * @return the resource name
38       */
39      String getResourceName( String classname );
40  
41      /***
42       * Write a ClassDescriptor to a file relative to specified base directory.
43       *
44       * @param baseDir the base directory to output to.
45       * @param descriptor the ClassDescriptor to write out.
46       * @throws Exception if unable ot write class descriptor.
47       */
48      void writeDescriptor( File baseDir, ClassDescriptor descriptor )
49          throws Exception;
50  }