org.apache.maven.settings.Settings.getModelEncoding()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(93)

本文整理了Java中org.apache.maven.settings.Settings.getModelEncoding()方法的一些代码示例,展示了Settings.getModelEncoding()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings.getModelEncoding()方法的具体详情如下:
包路径:org.apache.maven.settings.Settings
类名称:Settings
方法名:getModelEncoding

Settings.getModelEncoding介绍

[英]Get the modelEncoding field.
[中]获取modelEncoding字段。

代码示例

代码示例来源:origin: apache/maven

@Override
public void write( OutputStream output, Map<String, Object> options, Settings settings )
  throws IOException
{
  Objects.requireNonNull( output, "output cannot be null" );
  Objects.requireNonNull( settings, "settings cannot be null" );
  String encoding = settings.getModelEncoding();
  // TODO Use StringUtils here
  if ( encoding == null || encoding.length() <= 0 )
  {
    encoding = "UTF-8";
  }
  try ( final Writer out = new OutputStreamWriter( output, encoding ) )
  {
    write( out, options, settings );
  }
}

代码示例来源:origin: apache/maven

/**
 * Method write.
 * 
 * @param stream
 * @param settings
 * @throws java.io.IOException
 */
public void write( OutputStream stream, Settings settings )
  throws java.io.IOException
{
  XmlSerializer serializer = new MXSerializer();
  serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
  serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
  serializer.setOutput( stream, settings.getModelEncoding() );
  serializer.startDocument( settings.getModelEncoding(), null );
  writeSettings( settings, "settings", serializer );
  serializer.endDocument();
} //-- void write( OutputStream, Settings )

代码示例来源:origin: apache/maven

/**
 * Method write.
 * 
 * @param writer
 * @param settings
 * @throws java.io.IOException
 */
public void write( Writer writer, Settings settings )
  throws java.io.IOException
{
  XmlSerializer serializer = new MXSerializer();
  serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
  serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
  serializer.setOutput( writer );
  serializer.startDocument( settings.getModelEncoding(), null );
  writeSettings( settings, "settings", serializer );
  serializer.endDocument();
} //-- void write( Writer, Settings )

代码示例来源:origin: apache/maven

/**
   * @param settings could be null
   * @return a new instance of settings or null if settings was null.
   */
  public static Settings copySettings( Settings settings )
  {
    if ( settings == null )
    {
      return null;
    }

    Settings clone = new Settings();
    clone.setActiveProfiles( settings.getActiveProfiles() );
    clone.setInteractiveMode( settings.isInteractiveMode() );
    clone.setLocalRepository( settings.getLocalRepository() );
    clone.setMirrors( settings.getMirrors() );
    clone.setModelEncoding( settings.getModelEncoding() );
    clone.setOffline( settings.isOffline() );
    clone.setPluginGroups( settings.getPluginGroups() );
    clone.setProfiles( settings.getProfiles() );
    clone.setProxies( settings.getProxies() );
    clone.setServers( settings.getServers() );
    clone.setSourceLevel( settings.getSourceLevel() );
    clone.setUsePluginRegistry( settings.isUsePluginRegistry() );

    return clone;
  }
}

代码示例来源:origin: org.apache.maven/maven-settings

/**
 * Method write.
 * 
 * @param stream
 * @param settings
 * @throws java.io.IOException
 */
public void write( OutputStream stream, Settings settings )
  throws java.io.IOException
{
  XmlSerializer serializer = new MXSerializer();
  serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
  serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
  serializer.setOutput( stream, settings.getModelEncoding() );
  serializer.startDocument( settings.getModelEncoding(), null );
  writeSettings( settings, "settings", serializer );
  serializer.endDocument();
} //-- void write( OutputStream, Settings )

代码示例来源:origin: org.apache.maven/maven-settings

/**
 * Method write.
 * 
 * @param writer
 * @param settings
 * @throws java.io.IOException
 */
public void write( Writer writer, Settings settings )
  throws java.io.IOException
{
  XmlSerializer serializer = new MXSerializer();
  serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
  serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
  serializer.setOutput( writer );
  serializer.startDocument( settings.getModelEncoding(), null );
  writeSettings( settings, "settings", serializer );
  serializer.endDocument();
} //-- void write( Writer, Settings )

代码示例来源:origin: org.apache.maven/maven-settings-builder

@Override
public void write( OutputStream output, Map<String, Object> options, Settings settings )
  throws IOException
{
  Objects.requireNonNull( output, "output cannot be null" );
  Objects.requireNonNull( settings, "settings cannot be null" );
  String encoding = settings.getModelEncoding();
  // TODO Use StringUtils here
  if ( encoding == null || encoding.length() <= 0 )
  {
    encoding = "UTF-8";
  }
  try ( final Writer out = new OutputStreamWriter( output, encoding ) )
  {
    write( out, options, settings );
  }
}

代码示例来源:origin: io.tesla.maven/maven-settings-builder

public void write( OutputStream output, Map<String, Object> options, Settings settings )
  throws IOException
{
  if ( output == null )
  {
    throw new IllegalArgumentException( "output stream missing" );
  }
  if ( settings == null )
  {
    throw new IllegalArgumentException( "settings missing" );
  }
  try
  {
    String encoding = settings.getModelEncoding();
    if ( encoding == null || encoding.length() <= 0 )
    {
      encoding = "UTF-8";
    }
    write( new OutputStreamWriter( output, encoding ), options, settings );
  }
  finally
  {
    IOUtil.close( output );
  }
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-maven-embedder

String encoding = settings.getModelEncoding() != null ? settings.getModelEncoding() : "UTF-8";
outStr = new OutputStreamWriter(fo.getOutputStream(lock), encoding);
Format form = Format.getRawFormat().setEncoding(encoding);

代码示例来源:origin: org.codehaus.mevenide/nb-mvn-embedder

String encoding = settings.getModelEncoding() != null ? settings.getModelEncoding() : "UTF-8";
outStr = new OutputStreamWriter(fo.getOutputStream(lock), encoding);
Format form = Format.getRawFormat().setEncoding(encoding);

相关文章