All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.codehaus.mojo.natives.plugin.HelpMojo Maven / Gradle / Ivy

package org.codehaus.mojo.natives.plugin;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;

/**
 * Display help information on native-maven-plugin.
Call
  mvn native:help -Ddetail=true -Dgoal=<goal-name>
to display parameter details. * * @version generated on Wed Mar 09 00:17:12 PST 2011 * @author org.apache.maven.tools.plugin.generator.PluginHelpGenerator (version 2.7) * @goal help * @requiresProject false * @threadSafe */ public class HelpMojo extends AbstractMojo { /** * If true, display all settable properties for each goal. * * @parameter expression="${detail}" default-value="false" */ private boolean detail; /** * The name of the goal for which to show help. If unspecified, all goals will be displayed. * * @parameter expression="${goal}" */ private java.lang.String goal; /** * The maximum length of a display line, should be positive. * * @parameter expression="${lineLength}" default-value="80" */ private int lineLength; /** * The number of spaces per indentation level, should be positive. * * @parameter expression="${indentSize}" default-value="2" */ private int indentSize; /** {@inheritDoc} */ public void execute() throws MojoExecutionException { if ( lineLength <= 0 ) { getLog().warn( "The parameter 'lineLength' should be positive, using '80' as default." ); lineLength = 80; } if ( indentSize <= 0 ) { getLog().warn( "The parameter 'indentSize' should be positive, using '2' as default." ); indentSize = 2; } StringBuffer sb = new StringBuffer(); append( sb, "org.codehaus.mojo:native-maven-plugin:1.0-alpha-7", 0 ); append( sb, "", 0 ); append( sb, "Native Maven Plugin", 0 ); append( sb, "The Codehaus is a collaborative environment for building open source projects with a strong emphasis on modern languages, focussed on quality components that meet real world needs.", 1 ); append( sb, "", 0 ); if ( goal == null || goal.length() <= 0 ) { append( sb, "This plugin has 11 goals:", 0 ); append( sb, "", 0 ); } if ( goal == null || goal.length() <= 0 || "compile".equals( goal ) ) { append( sb, "native:compile", 0 ); append( sb, "Compile source files into native object files", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "compilerEndOptions", 2 ); append( sb, "Compiler options", 3 ); append( sb, "", 0 ); append( sb, "compilerExecutable", 2 ); append( sb, "Use this field to override provider specific compiler executable", 3 ); append( sb, "", 0 ); append( sb, "compilerMiddleOptions", 2 ); append( sb, "Compiler options", 3 ); append( sb, "", 0 ); append( sb, "compilerOutputDirectory (Default: ${project.build.directory}/objs)", 2 ); append( sb, "Compiler output files ( .o, .obj, etc) location", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "compilerProvider (Default: generic)", 2 ); append( sb, "Compiler Provider Type", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "compilerStartOptions", 2 ); append( sb, "Compiler options", 3 ); append( sb, "", 0 ); append( sb, "dependencyIncludeDirectory (Default: ${project.build.directory}/native/include)", 2 ); append( sb, "Directory to unpack .inczip dependency files to be included as system include path", 3 ); append( sb, "", 0 ); append( sb, "envFactoryName", 2 ); append( sb, "Specifies a fully qualified class name implementing the org.codehaus.mojo.natives.EnvFactory interface. The class creates a set environment variables to be used with the command line.", 3 ); append( sb, "", 0 ); append( sb, "javahOS", 2 ); append( sb, "Javah OS name. ${jdkIncludePath} and ${jdkIncludePath}/${javaOS} are added to system include path when this field is set", 3 ); append( sb, "", 0 ); append( sb, "jdkIncludePath (Default: ${java.home}/../include)", 2 ); append( sb, "JDK native include directory", 3 ); append( sb, "", 0 ); append( sb, "numberOfConcurrentCompilation (Default: 1)", 2 ); append( sb, "Number of parallel compilation threads", 3 ); append( sb, "", 0 ); append( sb, "objectFileExtension", 2 ); append( sb, "Use this field to override object file extension. The default extentions are .obj and .o on Windows and Unix respectively", 3 ); append( sb, "", 0 ); append( sb, "sources", 2 ); append( sb, "Array of NativeSources containing include directories and source files.", 3 ); append( sb, "", 0 ); append( sb, "workingDirectory (Default: ${basedir})", 2 ); append( sb, "user directory when external tools( ie compiler/linker ) are invoked", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "compile-message".equals( goal ) ) { append( sb, "native:compile-message", 0 ); append( sb, "Compile Windows message files", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "dependencyIncludeDirectory (Default: ${project.build.directory}/native/include)", 2 ); append( sb, "Directory to unpack .inczip dependency files to be included as system include path", 3 ); append( sb, "", 0 ); append( sb, "envFactoryName", 2 ); append( sb, "Specifies a fully qualified class name implementing the org.codehaus.mojo.natives.EnvFactory interface. The class creates a set environment variables to be used with the command line.", 3 ); append( sb, "", 0 ); append( sb, "messageCompilerExecutable", 2 ); append( sb, "Use this field to override provider specific message compiler executable", 3 ); append( sb, "", 0 ); append( sb, "messageCompilerOptions", 2 ); append( sb, "Additional Compiler options", 3 ); append( sb, "", 0 ); append( sb, "messageCompilerOutputDirectory", 2 ); append( sb, "Where to place the compiler object files", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "Expression: ${project.build.directory}", 3 ); append( sb, "", 0 ); append( sb, "messageFiles", 2 ); append( sb, "List of message files to compile", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "provider (Default: msvc)", 2 ); append( sb, "Compiler Provider Type", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "workingDirectory (Default: ${basedir})", 2 ); append( sb, "user directory when external tools( ie compiler/linker ) are invoked", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "help".equals( goal ) ) { append( sb, "native:help", 0 ); append( sb, "Display help information on native-maven-plugin.\nCall\n\u00a0\u00a0mvn\u00a0native:help\u00a0-Ddetail=true\u00a0-Dgoal=\nto display parameter details.", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "detail (Default: false)", 2 ); append( sb, "If true, display all settable properties for each goal.", 3 ); append( sb, "Expression: ${detail}", 3 ); append( sb, "", 0 ); append( sb, "goal", 2 ); append( sb, "The name of the goal for which to show help. If unspecified, all goals will be displayed.", 3 ); append( sb, "Expression: ${goal}", 3 ); append( sb, "", 0 ); append( sb, "indentSize (Default: 2)", 2 ); append( sb, "The number of spaces per indentation level, should be positive.", 3 ); append( sb, "Expression: ${indentSize}", 3 ); append( sb, "", 0 ); append( sb, "lineLength (Default: 80)", 2 ); append( sb, "The maximum length of a display line, should be positive.", 3 ); append( sb, "Expression: ${lineLength}", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "inczip".equals( goal ) ) { append( sb, "native:inczip", 0 ); append( sb, "Prepare include file bundle to be attached to maven for deployment purpose", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "dependencyIncludeDirectory (Default: ${project.build.directory}/native/include)", 2 ); append( sb, "Directory to unpack .inczip dependency files to be included as system include path", 3 ); append( sb, "", 0 ); append( sb, "envFactoryName", 2 ); append( sb, "Specifies a fully qualified class name implementing the org.codehaus.mojo.natives.EnvFactory interface. The class creates a set environment variables to be used with the command line.", 3 ); append( sb, "", 0 ); append( sb, "inZipFile (Default: ${project.build.directory}/${project.build.finalName}-${project.version}.inczip)", 2 ); append( sb, "Archive file to bundle all enable NativeSources", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "skipIncludeDeployment (Default: false)", 2 ); append( sb, "Option to skip include source bundle deployment", 3 ); append( sb, "", 0 ); append( sb, "sources", 2 ); append( sb, "Array of NativeSources containing include directories and source files.", 3 ); append( sb, "", 0 ); append( sb, "workingDirectory (Default: ${basedir})", 2 ); append( sb, "user directory when external tools( ie compiler/linker ) are invoked", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "initialize".equals( goal ) ) { append( sb, "native:initialize", 0 ); append( sb, "Initialize build lifecycle", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "project", 2 ); append( sb, "Internal", 3 ); append( sb, "Expression: ${project}", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "javah".equals( goal ) ) { append( sb, "native:javah", 0 ); append( sb, "Generate JNI include files based on a set of class names", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "classNames", 2 ); append( sb, "Deprecated. Use javahClassNames instead. Note starting 1.0-alpha-4, running javah in its own execution is no longer necessary since it is implicitly bound to all shared library custom lifecycle.", 3 ); append( sb, "", 0 ); append( sb, "(no description available)", 3 ); append( sb, "", 0 ); append( sb, "dependencyIncludeDirectory (Default: ${project.build.directory}/native/include)", 2 ); append( sb, "Directory to unpack .inczip dependency files to be included as system include path", 3 ); append( sb, "", 0 ); append( sb, "envFactoryName", 2 ); append( sb, "Specifies a fully qualified class name implementing the org.codehaus.mojo.natives.EnvFactory interface. The class creates a set environment variables to be used with the command line.", 3 ); append( sb, "", 0 ); append( sb, "javahClassNames", 2 ); append( sb, "List of class names to generate native files. Additional JNI interface will automatically discovered from project\'s dependencies of jar type, when javahSearchJNIFromDependencies is true", 3 ); append( sb, "", 0 ); append( sb, "javahOutputDirectory (Default: ${project.build.directory}/native/javah)", 2 ); append( sb, "Where to place javah generated file", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "javahOutputFileName", 2 ); append( sb, "if configured will be combined with outputDirectory to pass into javah\'s -o option", 3 ); append( sb, "", 0 ); append( sb, "javahPath", 2 ); append( sb, "Path to javah executable, if present, it will override the default one which bases on architecture type. See \'javahProvider\' argument", 3 ); append( sb, "", 0 ); append( sb, "javahProvider (Default: default)", 2 ); append( sb, "Javah Provider.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "javahSearchJNIFromDependencies (Default: false)", 2 ); append( sb, "Enable the search from project dependencies for JNI interfaces, in addition to javahClassNames", 3 ); append( sb, "", 0 ); append( sb, "javahVerbose (Default: false)", 2 ); append( sb, "Enable javah verbose mode", 3 ); append( sb, "", 0 ); append( sb, "outputDirectory", 2 ); append( sb, "Deprecated. use javahOutputDirectory instead", 3 ); append( sb, "", 0 ); append( sb, "Where to place javah generated file", 3 ); append( sb, "", 0 ); append( sb, "outputFileName", 2 ); append( sb, "Deprecated. Use javaOutputFileName instead", 3 ); append( sb, "", 0 ); append( sb, "if configured will be combined with outputDirectory to pass into javah\'s -o option", 3 ); append( sb, "", 0 ); append( sb, "workingDirectory (Default: ${basedir})", 2 ); append( sb, "user directory when external tools( ie compiler/linker ) are invoked", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "link".equals( goal ) ) { append( sb, "native:link", 0 ); append( sb, "Link all previously built object and dependent library files into final build artifact", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "attach (Default: true)", 2 ); append( sb, "Attach the linker\'s outputs to maven project be installed/deployed. Turn this off if you have other mean of deployment, for example using maven-assembly-plugin to deploy your own bundle", 3 ); append( sb, "", 0 ); append( sb, "classifier", 2 ); append( sb, "Option to install primary artifact as a classifier, useful to install/deploy debug artifacts", 3 ); append( sb, "", 0 ); append( sb, "compilerProvider (Default: generic)", 2 ); append( sb, "Override this property if permitted by compilerProvider", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "dependencyIncludeDirectory (Default: ${project.build.directory}/native/include)", 2 ); append( sb, "Directory to unpack .inczip dependency files to be included as system include path", 3 ); append( sb, "", 0 ); append( sb, "envFactoryName", 2 ); append( sb, "Specifies a fully qualified class name implementing the org.codehaus.mojo.natives.EnvFactory interface. The class creates a set environment variables to be used with the command line.", 3 ); append( sb, "", 0 ); append( sb, "externalLibDirectory (Default: ${project.build.directory}/lib)", 2 ); append( sb, "Dependent libraries with version + classifier removed are copied to this directory to be linked to the build artifact", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "linkerEndOptions", 2 ); append( sb, "Additional linker command options", 3 ); append( sb, "", 0 ); append( sb, "linkerExecutable", 2 ); append( sb, "Override this property if permitted by linkerProvider. Default to compilerType if not provided", 3 ); append( sb, "", 0 ); append( sb, "linkerMiddleOptions", 2 ); append( sb, "Additional linker command options", 3 ); append( sb, "", 0 ); append( sb, "linkerOutputDirectory (Default: ${project.build.directory})", 2 ); append( sb, "Where to place the final packaging", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "linkerProvider", 2 ); append( sb, "Default value is ${compilerProvider}", 3 ); append( sb, "", 0 ); append( sb, "linkerSecondaryOutputExtensions", 2 ); append( sb, "Comma separated extension type to be installed/deployed. Use this option to deploy library file produced by dll build on windows", 3 ); append( sb, "", 0 ); append( sb, "linkerStartOptions", 2 ); append( sb, "Additional linker command options", 3 ); append( sb, "", 0 ); append( sb, "linkingOrderLibs", 2 ); append( sb, "Option to reorder dependency list, each item has the format of ${groupId}:${artifactId}", 3 ); append( sb, "", 0 ); append( sb, "usingLinkerResponseFile (Default: false)", 2 ); append( sb, "For project with lots of object files on windows, turn this flag to resolve Windows commandline length limit", 3 ); append( sb, "", 0 ); append( sb, "workingDirectory (Default: ${basedir})", 2 ); append( sb, "user directory when external tools( ie compiler/linker ) are invoked", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "manifest".equals( goal ) ) { append( sb, "native:manifest", 0 ); append( sb, "Embeds a Visual Studio manifest file into a generated executable", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "dependencyIncludeDirectory (Default: ${project.build.directory}/native/include)", 2 ); append( sb, "Directory to unpack .inczip dependency files to be included as system include path", 3 ); append( sb, "", 0 ); append( sb, "envFactoryName", 2 ); append( sb, "Specifies a fully qualified class name implementing the org.codehaus.mojo.natives.EnvFactory interface. The class creates a set environment variables to be used with the command line.", 3 ); append( sb, "", 0 ); append( sb, "manifestExtension (Default: manifest)", 2 ); append( sb, "Manifest extension", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "provider (Default: msvc)", 2 ); append( sb, "Manifest Provider.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "workingDirectory (Default: ${basedir})", 2 ); append( sb, "user directory when external tools( ie compiler/linker ) are invoked", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "ranlib".equals( goal ) ) { append( sb, "native:ranlib", 0 ); append( sb, "ranlib a Unix linker output file", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "dependencyIncludeDirectory (Default: ${project.build.directory}/native/include)", 2 ); append( sb, "Directory to unpack .inczip dependency files to be included as system include path", 3 ); append( sb, "", 0 ); append( sb, "envFactoryName", 2 ); append( sb, "Specifies a fully qualified class name implementing the org.codehaus.mojo.natives.EnvFactory interface. The class creates a set environment variables to be used with the command line.", 3 ); append( sb, "", 0 ); append( sb, "provider (Default: default)", 2 ); append( sb, "Ranlib Provider.", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "ranlibOutputDirectory (Default: ${project.build.directory})", 2 ); append( sb, "Where to place the final packaging", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "workingDirectory (Default: ${basedir})", 2 ); append( sb, "user directory when external tools( ie compiler/linker ) are invoked", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "resource-compile".equals( goal ) ) { append( sb, "native:resource-compile", 0 ); append( sb, "Compile Windows resource files", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "dependencyIncludeDirectory (Default: ${project.build.directory}/native/include)", 2 ); append( sb, "Directory to unpack .inczip dependency files to be included as system include path", 3 ); append( sb, "", 0 ); append( sb, "envFactoryName", 2 ); append( sb, "Specifies a fully qualified class name implementing the org.codehaus.mojo.natives.EnvFactory interface. The class creates a set environment variables to be used with the command line.", 3 ); append( sb, "", 0 ); append( sb, "provider (Default: msvc)", 2 ); append( sb, "Compiler Provider Type", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "resourceCompilerExecutable", 2 ); append( sb, "Use this field to override provider specific resource compiler executable", 3 ); append( sb, "", 0 ); append( sb, "resourceCompilerOptions", 2 ); append( sb, "Resource compiler options", 3 ); append( sb, "", 0 ); append( sb, "resourceCompilerOutputDirectory (Default: ${project.build.directory})", 2 ); append( sb, "(no description available)", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "sources", 2 ); append( sb, "Array of NativeSources containing include directories and source files", 3 ); append( sb, "", 0 ); append( sb, "workingDirectory (Default: ${basedir})", 2 ); append( sb, "user directory when external tools( ie compiler/linker ) are invoked", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); } } if ( goal == null || goal.length() <= 0 || "unzipinc".equals( goal ) ) { append( sb, "native:unzipinc", 0 ); append( sb, "Unpack any .inczip dependencies to be included as system include path", 1 ); append( sb, "", 0 ); if ( detail ) { append( sb, "Available parameters:", 1 ); append( sb, "", 0 ); append( sb, "dependencyIncludeDirectory (Default: ${project.build.directory}/native/include)", 2 ); append( sb, "Directory to unpack .inczip dependency files to be included as system include path", 3 ); append( sb, "", 0 ); append( sb, "dependencyIncZipMarkerDirectory (Default: ${project.build.directory}/native/markers)", 2 ); append( sb, "Internal", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); append( sb, "envFactoryName", 2 ); append( sb, "Specifies a fully qualified class name implementing the org.codehaus.mojo.natives.EnvFactory interface. The class creates a set environment variables to be used with the command line.", 3 ); append( sb, "", 0 ); append( sb, "workingDirectory (Default: ${basedir})", 2 ); append( sb, "user directory when external tools( ie compiler/linker ) are invoked", 3 ); append( sb, "Required: Yes", 3 ); append( sb, "", 0 ); } } if ( getLog().isInfoEnabled() ) { getLog().info( sb.toString() ); } } /** *

Repeat a String n times to form a new string.

* * @param str String to repeat * @param repeat number of times to repeat str * @return String with repeated String * @throws NegativeArraySizeException if repeat < 0 * @throws NullPointerException if str is null */ private static String repeat( String str, int repeat ) { StringBuffer buffer = new StringBuffer( repeat * str.length() ); for ( int i = 0; i < repeat; i++ ) { buffer.append( str ); } return buffer.toString(); } /** * Append a description to the buffer by respecting the indentSize and lineLength parameters. * Note: The last character is always a new line. * * @param sb The buffer to append the description, not null. * @param description The description, not null. * @param indent The base indentation level of each line, must not be negative. */ private void append( StringBuffer sb, String description, int indent ) { for ( Iterator it = toLines( description, indent, indentSize, lineLength ).iterator(); it.hasNext(); ) { sb.append( it.next().toString() ).append( '\n' ); } } /** * Splits the specified text into lines of convenient display length. * * @param text The text to split into lines, must not be null. * @param indent The base indentation level of each line, must not be negative. * @param indentSize The size of each indentation, must not be negative. * @param lineLength The length of the line, must not be negative. * @return The sequence of display lines, never null. * @throws NegativeArraySizeException if indent < 0 */ private static List toLines( String text, int indent, int indentSize, int lineLength ) { List lines = new ArrayList(); String ind = repeat( "\t", indent ); String[] plainLines = text.split( "(\r\n)|(\r)|(\n)" ); for ( int i = 0; i < plainLines.length; i++ ) { toLines( lines, ind + plainLines[i], indentSize, lineLength ); } return lines; } /** * Adds the specified line to the output sequence, performing line wrapping if necessary. * * @param lines The sequence of display lines, must not be null. * @param line The line to add, must not be null. * @param indentSize The size of each indentation, must not be negative. * @param lineLength The length of the line, must not be negative. */ private static void toLines( List lines, String line, int indentSize, int lineLength ) { int lineIndent = getIndentLevel( line ); StringBuffer buf = new StringBuffer( 256 ); String[] tokens = line.split( " +" ); for ( int i = 0; i < tokens.length; i++ ) { String token = tokens[i]; if ( i > 0 ) { if ( buf.length() + token.length() >= lineLength ) { lines.add( buf.toString() ); buf.setLength( 0 ); buf.append( repeat( " ", lineIndent * indentSize ) ); } else { buf.append( ' ' ); } } for ( int j = 0; j < token.length(); j++ ) { char c = token.charAt( j ); if ( c == '\t' ) { buf.append( repeat( " ", indentSize - buf.length() % indentSize ) ); } else if ( c == '\u00A0' ) { buf.append( ' ' ); } else { buf.append( c ); } } } lines.add( buf.toString() ); } /** * Gets the indentation level of the specified line. * * @param line The line whose indentation level should be retrieved, must not be null. * @return The indentation level of the line. */ private static int getIndentLevel( String line ) { int level = 0; for ( int i = 0; i < line.length() && line.charAt( i ) == '\t'; i++ ) { level++; } for ( int i = level + 1; i <= level + 4 && i < line.length(); i++ ) { if ( line.charAt( i ) == '\t' ) { level++; break; } } return level; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy