本文整理了Java中org.codehaus.plexus.util.IOUtil.toString()
方法的一些代码示例,展示了IOUtil.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtil.toString()
方法的具体详情如下:
包路径:org.codehaus.plexus.util.IOUtil
类名称:IOUtil
方法名:toString
[英]Get the contents of an InputStream
as a String. The platform's default encoding is used for the byte-to-char conversion.
[中]以字符串形式获取InputStream
的内容。平台的默认编码用于字节到字符的转换。
代码示例来源:origin: org.codehaus.plexus/plexus-utils
/**
* Get the contents of an <code>InputStream</code> as a String.
*
* @param encoding The name of a supported character encoding. See the
* <a href="http://www.iana.org/assignments/character-sets">IANA Charset Registry</a> for a list of valid
* encoding types.
*/
public static String toString( final InputStream input, final String encoding )
throws IOException
{
return toString( input, encoding, DEFAULT_BUFFER_SIZE );
}
代码示例来源:origin: org.codehaus.plexus/plexus-utils
/**
* Get the contents of an <code>InputStream</code> as a String. The platform's default encoding is used for the
* byte-to-char conversion.
*/
public static String toString( final InputStream input )
throws IOException
{
return toString( input, DEFAULT_BUFFER_SIZE );
}
代码示例来源:origin: org.codehaus.plexus/plexus-utils
/**
* Get the contents of a <code>Reader</code> as a String.
*/
public static String toString( final Reader input )
throws IOException
{
return toString( input, DEFAULT_BUFFER_SIZE );
}
代码示例来源:origin: org.codehaus.plexus/plexus-utils
/**
* Get the contents of a <code>byte[]</code> as a String. The platform's default encoding is used for the
* byte-to-char conversion.
*/
public static String toString( final byte[] input )
throws IOException
{
return toString( input, DEFAULT_BUFFER_SIZE );
}
代码示例来源:origin: org.codehaus.plexus/plexus-utils
/**
* Get the contents of a <code>byte[]</code> as a String.
*
* @param encoding The name of a supported character encoding. See the
* <a href="http://www.iana.org/assignments/character-sets">IANA Charset Registry</a> for a list of valid
* encoding types.
*/
public static String toString( final byte[] input, final String encoding )
throws IOException
{
return toString( input, encoding, DEFAULT_BUFFER_SIZE );
}
代码示例来源:origin: org.apache.maven/maven-project
private Model readModel( String projectId,
String pomLocation,
Reader reader,
boolean strict )
throws IOException, InvalidProjectModelException
{
String modelSource = IOUtil.toString( reader );
if ( modelSource.indexOf( "<modelVersion>" + MAVEN_MODEL_VERSION ) < 0 )
{
throw new InvalidProjectModelException( projectId, pomLocation, "Not a v" + MAVEN_MODEL_VERSION + " POM." );
}
StringReader sReader = new StringReader( modelSource );
try
{
return modelReader.read( sReader, strict );
}
catch ( XmlPullParserException e )
{
throw new InvalidProjectModelException( projectId, pomLocation,
"Parse error reading POM. Reason: " + e.getMessage(), e );
}
}
代码示例来源:origin: takari/polyglot-maven
public Model read(final Reader input, final Map<String, ?> options) throws IOException {
assert input != null;
// Parse the token stream from our pom.atom configuration file.
Project project = new AtomParser((ModelSource)options.get(ModelProcessor.SOURCE), new Tokenizer(IOUtil.toString(input)).tokenize()).parse();
return project.toMavenModel();
}
}
代码示例来源:origin: takari/polyglot-maven
String text = IOUtil.toString(input);
String location = PolyglotModelUtil.getLocation(options);
Script script = shell.parse(new GroovyCodeSource(text, location, location));
代码示例来源:origin: org.apache.servicemix.kernel.gshell/org.apache.servicemix.kernel.gshell.core
/**
* Get the contents of a <code>byte[]</code> as a String.
* @param encoding The name of a supported character encoding. See the
* <a href="http://www.iana.org/assignments/character-sets">IANA
* Charset Registry</a> for a list of valid encoding types.
*/
public static String toString( final byte[] input, final String encoding )
throws IOException
{
return toString( input, encoding, DEFAULT_BUFFER_SIZE );
}
代码示例来源:origin: org.apache.servicemix.kernel.gshell/org.apache.servicemix.kernel.gshell.core
/**
* Get the contents of a <code>Reader</code> as a String.
*/
public static String toString( final Reader input )
throws IOException
{
return toString( input, DEFAULT_BUFFER_SIZE );
}
代码示例来源:origin: org.nuiton/maven-helper-plugin
/**
* Permet de lire un fichier et de retourner sont contenu sous forme d'une
* chaine de carateres
*
* @param reader la source alire
* @return the content of the file
* @throws IOException if IO pb
*/
static public String readAsString(Reader reader) throws IOException {
return IOUtil.toString(reader);
}
代码示例来源:origin: org.eclipse.tycho/tycho-testing-harness
@Override
public boolean visitEntry(ZipEntry entry, ZipInputStream stream) throws Exception {
if (fileInArchive.equals(entry.getName())) {
result[0] = IOUtil.toString(stream);
return false;
}
return true;
}
});
代码示例来源:origin: org.zkoss.maven/yuicompressor-maven-plugin-zk
/**
* This method is defined as a JavaScript function.
*/
public String readFile(String path) {
try {
return IOUtil.toString(new FileInputStream(path));
} catch (RuntimeException exc) {
throw exc;
} catch (Exception exc) {
throw new RuntimeException("wrap: " + exc.getMessage(), exc);
}
}
代码示例来源:origin: org.sonatype.plexus/plexus-jetty-testsuite
public KeyHandler()
throws IOException
{
addKey( TEST_KEY_1,
IOUtil.toString( getClass().getResourceAsStream( "/com/sonatype/mercury/plexus/pgp/testkey1.txt" ) ) );
addKey( TEST_KEY_2,
IOUtil.toString( getClass().getResourceAsStream( "/com/sonatype/mercury/plexus/pgp/testkey2.txt" ) ) );
}
代码示例来源:origin: Microsoft/azure-maven-plugins
protected void showErrorIfAny(final InputStream inputStream) throws Exception {
if (inputStream != null) {
final String input = IOUtil.toString(inputStream);
this.logger.error(org.codehaus.plexus.util.StringUtils.strip(input, "\n"));
}
}
}
代码示例来源:origin: mycila/license-maven-plugin
public static String read(URL location, String encoding, Map<String, String> properties) throws IOException {
Reader reader = new InterpolationFilterReader(new BufferedReader(new InputStreamReader(location.openStream(), encoding)), properties);
try {
return IOUtil.toString(reader);
} finally {
reader.close();
}
}
代码示例来源:origin: com.mycila.maven-license-plugin/maven-license-plugin
public static String read(URL location, Map<String, String> properties) throws IOException {
Reader reader = new InterpolationFilterReader(new BufferedReader(new InputStreamReader(location.openStream())), properties);
try {
return IOUtil.toString(reader);
} finally {
reader.close();
}
}
代码示例来源:origin: apache/maven-release
public static String readXmlFile( File file, String ls )
throws IOException
{
try ( Reader reader = ReaderFactory.newXmlReader( file ) )
{
return normalizeLineEndings( IOUtil.toString( reader ), ls );
}
}
代码示例来源:origin: eclipse/eclipse.jdt.ls
public static String getContent(IFile file) throws CoreException {
if (file == null) {
return null;
}
String content;
try {
content = IOUtil.toString(file.getContents());
} catch (IOException e) {
throw new CoreException(StatusFactory.newErrorStatus("Can not get " + file.getRawLocation() + " content", e));
}
return content;
}
代码示例来源:origin: io.tesla.polyglot/tesla-polyglot-atom
public Model read(final Reader input, final Map<String, ?> options) throws IOException {
assert input != null;
// Parse the token stream from our pom.atom configuration file.
Project project = new AtomParser((ModelSource)options.get(ModelProcessor.SOURCE), new Tokenizer(IOUtil.toString(input)).tokenize()).parse();
return project.toMavenModel();
}
}
内容来源于网络,如有侵权,请联系作者删除!