gov.nasa.pds.ltdt.label.reformat
Class LabelReformatter

java.lang.Object
  extended by gov.nasa.pds.ltdt.label.reformat.LabelReformatter

public class LabelReformatter
extends java.lang.Object

Class to reformat a PDS label so that it will have the following characteristics:

Author:
mcayanan

Constructor Summary
LabelReformatter()
           
 
Method Summary
 int getMaxIdentifierLength(java.util.List prettyStatements, short indent)
          Get the longest identifier length out of the given list of statements.
 java.io.ByteArrayOutputStream reformat(java.io.InputStream label)
          Return a stream representation of a reformatted PDS label, where the max position of the '=' will be up to a default position of 40.
 java.io.ByteArrayOutputStream reformat(java.io.InputStream label, int maxEquals)
          Return a stream that contains a reformatted label, where all equals sign are aligned and all groups and objects are indented.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LabelReformatter

public LabelReformatter()
Method Detail

reformat

public java.io.ByteArrayOutputStream reformat(java.io.InputStream label)
                                       throws java.io.IOException
Return a stream representation of a reformatted PDS label, where the max position of the '=' will be up to a default position of 40.

Parameters:
label - A stream representation of the PDS label.
Returns:
A stream representation of a reformatted PDS label.
Throws:
java.io.IOException

reformat

public java.io.ByteArrayOutputStream reformat(java.io.InputStream label,
                                              int maxEquals)
                                       throws java.io.IOException
Return a stream that contains a reformatted label, where all equals sign are aligned and all groups and objects are indented. The '=' will be one character past the longest element name up to the given maximum predefined position.

Parameters:
label - A stream representation of the PDS label.
maxEquals - The maximum position of the '='.
Returns:
A stream representation of the PDS label.
Throws:
java.io.IOException

getMaxIdentifierLength

public int getMaxIdentifierLength(java.util.List prettyStatements,
                                  short indent)
Get the longest identifier length out of the given list of statements.

Parameters:
prettyStatements - The list of PrettyStatement objects.
indent - The number of spaces that the statement will be indented.
Returns:
The value of the longest identifier length, including the indentation.


Copyright © 2005-2008 NASA Jet Propulsion Laboratory, California Institute of Technology. All Rights Reserved.