Refine search
private Model readModel( String projectId, URL url, boolean strict ) throws ProjectBuildingException { Reader reader = null; try { reader = ReaderFactory.newXmlReader( url.openStream() ); return readModel( projectId, url.toExternalForm(), reader, strict ); } catch ( IOException e ) { throw new ProjectBuildingException( projectId, "Failed build model from URL \'" + url.toExternalForm() + "\'\nError: \'" + e.getLocalizedMessage() + "\'", e ); } finally { IOUtil.close( reader ); } }
reader = ReaderFactory.newReader( inputStream, inputEncoding ); reader = ReaderFactory.newXmlReader( inputStream );
/** * Method read. * * @param in * @throws IOException * @throws XmlPullParserException * @return LifecycleConfiguration */ public LifecycleConfiguration read( InputStream in ) throws IOException, XmlPullParserException { return read( ReaderFactory.newXmlReader( in ) ); } //-- LifecycleConfiguration read( InputStream )
/** * Read the given file and return the content as a string. * * @param file the file * @return the string * @throws IOException Signals that an I/O exception has occurred. */ private String readFileAsString(File file) throws java.io.IOException { StringBuilder fileData = new StringBuilder(1000); BufferedReader reader = null; try { reader = new BufferedReader(ReaderFactory.newReader(file, this.encoding)); char[] buf = new char[1024]; int numRead = 0; while ((numRead = reader.read(buf)) != -1) { String readData = String.valueOf(buf, 0, numRead); fileData.append(readData); buf = new char[1024]; } } finally { IOUtil.close(reader); } return fileData.toString(); }
reader = ReaderFactory.newXmlReader( originalFile ); reader = new InterpolationFilterReader( reader, composite, "@", "@" ); xml = IOUtil.toString( reader ); IOUtil.close( reader ); IOUtil.close( writer );
reader = ReaderFactory.newXmlReader( inputFile ); reader = ReaderFactory.newReader( inputFile, inputEncoding ); reader = ReaderFactory.newPlatformReader( inputFile ); try r = ReaderFactory.newXmlReader( outputFile ); CharArrayWriter caw = new CharArrayWriter(); XmlUtil.prettyFormat( r, caw ); IOUtil.close( r ); IOUtil.close( w );
try in = ReaderFactory.newXmlReader( inputFile ); String initialcontent = IOUtil.toString( in ); IOUtil.copy( content, out ); IOUtil.close( in ); IOUtil.close( out ); try in = ReaderFactory.newXmlReader( initialPomFile ); String initialcontent = IOUtil.toString( in );
/** * @param f not null * @param encoding the encoding file used * @return the content of the file or null if an error occurred. */ private static String read( File f, String encoding ) { Reader reader = null; try { reader = ReaderFactory.newReader( f, encoding ); return IOUtil.toString( reader ); } catch ( IOException e ) { // nop; } finally { IOUtil.close( reader ); } return null; } }
/** * Reads a file into a String. * * @param outFile The file to read. * @return String The content of the file. * @throws java.io.IOException when things go wrong. */ public static StringBuilder readXmlFile( File outFile ) throws IOException { try( Reader reader = ReaderFactory.newXmlReader( outFile ) ) { return new StringBuilder( IOUtil.toString( reader ) ); } }
reader = ReaderFactory.newXmlReader( doc ); if ( siteContext.isValidate() ) case Parser.UNKNOWN_TYPE: default: reader = ReaderFactory.newReader( doc, siteContext.getInputEncoding() ); IOUtil.close( reader );
if ( XmlUtil.isXml( f ) ) reader = ReaderFactory.newXmlReader( f ); reader = ReaderFactory.newPlatformReader( f ); IOUtil.close( reader ); IOUtil.close( writer );
try ( Reader profileReader = ReaderFactory.newXmlReader( profilesXml ); StringWriter sWriter = new StringWriter() ) IOUtil.copy( profileReader, sWriter );
private Reader getDescriptorReader( ZipFile zipFile, String descriptor ) throws IOException { ZipEntry entry = searchEntry( zipFile, descriptor ); if ( entry == null ) { return null; } InputStream is = zipFile.getInputStream( entry ); if ( is == null ) { throw new IOException( "The " + descriptor + " descriptor cannot be read in " + zipFile.getName() + "." ); } return ReaderFactory.newReader( is, ReaderFactory.UTF_8 ); }
/** * Creates a new reader for the specified file, using the plugin's {@link #encoding} parameter. * * @param file The file to create a reader for, must not be <code>null</code>. * @return The reader for the file, never <code>null</code>. * @throws java.io.IOException If the specified file was not found or the configured encoding is not supported. */ private Reader newReader( File file ) throws IOException { if ( StringUtils.isNotEmpty( encoding ) ) { return ReaderFactory.newReader( file, encoding ); } else { return ReaderFactory.newPlatformReader( file ); } }
private Model readModel( final File pom ) throws ProjectToolsException { Reader reader = null; try { reader = ReaderFactory.newPlatformReader( pom ); return new MavenXpp3Reader().read( reader, false ); } catch ( final IOException e ) { LOGGER.error( String.format( "Failed to read POM: %s.\nReason: %s", pom, e.getMessage() ), e ); throw new ProjectToolsException( "Failed to read POM: %s. Reason: %s", e, pom.getAbsolutePath(), e.getMessage() ); } catch ( final XmlPullParserException e ) { LOGGER.error( String.format( "Failed to read POM: %s.\nReason: %s", pom, e.getMessage() ), e ); throw new ProjectToolsException( "Failed to read POM: %s. Reason: %s", e, pom.getAbsolutePath(), e.getMessage() ); } finally { IOUtils.closeQuietly( reader ); } }
/** * Method read. * * @param in * @param strict * @throws IOException * @throws XmlPullParserException * @return LifecycleConfiguration */ public LifecycleConfiguration read( InputStream in, boolean strict ) throws IOException, XmlPullParserException { return read( ReaderFactory.newXmlReader( in ), strict ); } //-- LifecycleConfiguration read( InputStream, boolean )
reader = ReaderFactory.newXmlReader( originalFile ); reader = new InterpolationFilterReader( reader, composite, "@", "@" ); xml = IOUtil.toString( reader ); IOUtil.close( reader ); IOUtil.close( writer );
reader = ReaderFactory.newXmlReader( f ); reader = ReaderFactory.newPlatformReader( f ); reader = ReaderFactory.newReader( f, context.getInputEncoding() ); IOUtil.close( reader );