org.modeshape.sequencer.java
Class JavaMetadataUtil

java.lang.Object
  extended by org.modeshape.sequencer.java.JavaMetadataUtil

public class JavaMetadataUtil
extends Object

Utility class for working with metadata.


Method Summary
static String createPath(String path)
          Create a path for the tree without index.
static String createPathWithIndex(String path, int index)
          Create a path for the tree with index.
static char[] getJavaSourceFromTheInputStream(InputStream inputStream, long length, String encoding)
          Gets Java source from the InputStream.
static String getName(org.eclipse.jdt.core.dom.Name name)
          Get the fully qualified name from the Name.
static long length(InputStream stream)
          Get the length of the input stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

length

public static long length(InputStream stream)
                   throws IOException
Get the length of the input stream.

Parameters:
stream - - the InputStream
Returns:
the length of the stream.
Throws:
IOException - - exceptional situation during calculating the length.

getJavaSourceFromTheInputStream

public static char[] getJavaSourceFromTheInputStream(InputStream inputStream,
                                                     long length,
                                                     String encoding)
                                              throws IOException
Gets Java source from the InputStream.

Parameters:
inputStream - - the FileInputStream.
length - - the length of the java file.
encoding - - the encoding of the source, if there is one.
Returns:
the array character of the java source.
Throws:
IOException - - exceptional error can be thrown during the reading of the file.

getName

public static String getName(org.eclipse.jdt.core.dom.Name name)
Get the fully qualified name from the Name.

Parameters:
name - - the name to process.
Returns:
a FQN of the name.

createPathWithIndex

public static String createPathWithIndex(String path,
                                         int index)
Create a path for the tree with index.

Parameters:
path - the path.
index - the index begin with 1.
Returns:
the string
Throws:
IllegalArgumentException - if the path is null, blank or empty, or if the index is not a positive value

createPath

public static String createPath(String path)
Create a path for the tree without index.

Parameters:
path - - the path.
Returns:
the string
Throws:
IllegalArgumentException - if the path is null, blank or empty


Copyright © 2008-2011 JBoss, a division of Red Hat. All Rights Reserved.