/** * 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 ); }
/** * 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 ); }
/** * 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 ); }
/** * 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 ); }
/** * 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 ); }
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 ); } }
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(); } }
String text = IOUtil.toString(input); String location = PolyglotModelUtil.getLocation(options); Script script = shell.parse(new GroovyCodeSource(text, location, location));
/** * 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 ); }
/** * 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 ); }
/** * 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); }
@Override public boolean visitEntry(ZipEntry entry, ZipInputStream stream) throws Exception { if (fileInArchive.equals(entry.getName())) { result[0] = IOUtil.toString(stream); return false; } return true; } });
/** * 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); } }
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")); } } }
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(); } }
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(); } }
public static String readXmlFile( File file, String ls ) throws IOException { try ( Reader reader = ReaderFactory.newXmlReader( file ) ) { return normalizeLineEndings( IOUtil.toString( reader ), 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; }
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(); } }