Examples of InputSource


Examples of anvil.parser.InputSource

        product = null;
      }

      if (printPretty) {
        ByteArrayOutputStream byteStream =(ByteArrayOutputStream)scriptOutput;
        InputSource inputSource =
          new StreamInputSource(new ByteArrayInputStream(byteStream.toByteArray()));
        Writer writer = new PrintWriter(finalOutput);
        PrettyPrinter prettyPrinter = new PrettyPrinter(inputSource, writer);
        prettyPrinter.print();
        writer.flush();
View Full Code Here

Examples of cascading.flow.stream.element.InputSource

  @Override
  public void run( Map<String, LogicalInput> inputMap, Map<String, LogicalOutput> outputMap ) throws Exception
    {
    Collection<Duct> allHeads;
    InputSource streamedHead;

    try
      {
      streamGraph = new Hadoop2TezStreamGraph( currentProcess, flowNode, inputMap, outputMap );

      allHeads = streamGraph.getHeads();
      streamedHead = streamGraph.getStreamedHead();

      for( Duct head : allHeads )
        LOG.info( "sourcing from: {} streamed: {}", ( (ElementDuct) head ).getFlowElement(), head == streamedHead );

      for( Duct tail : streamGraph.getTails() )
        LOG.info( "sinking to: {}", ( (ElementDuct) tail ).getFlowElement() );

      for( Tap trap : flowNode.getTraps() )
        LOG.info( "trapping to: {}", trap );
      }
    catch( Throwable throwable )
      {
      if( throwable instanceof CascadingException )
        throw (CascadingException) throwable;

      throw new FlowException( "internal error during processor configuration", throwable );
      }

    streamGraph.prepare(); // starts inputs

    // wait for shuffle
    waitForInputsRead( inputMap );

    // user code begins executing from here
    long processBeginTime = System.currentTimeMillis();

    currentProcess.increment( SliceCounters.Process_Begin_Time, processBeginTime );

    Iterator<Duct> iterator = allHeads.iterator();

    try
      {
      try
        {
        while( iterator.hasNext() )
          {
          Duct next = iterator.next();

          if( next != streamedHead )
            ( (InputSource) next ).run( null );
          }

        streamedHead.run( null );
        }
      catch( OutOfMemoryError | IOException error )
        {
        throw error;
        }
View Full Code Here

Examples of com.alibaba.citrus.util.templatelite.Template.InputSource

                new BufferedInputStream(new ByteArrayInputStream(content.getBytes("ISO-8859-1"))), "default");
    }

    @Test
    public void getRelative_File() throws Exception {
        InputSource parentSource = new InputSource(new File("/aa/bb/cc.txt"));

        assertNull(parentSource.getRelative(null));
        assertNull(parentSource.getRelative("  "));

        inputSource = parentSource.getRelative(" b.txt ");
        assertEquals(new File("/aa/bb/b.txt").toURI().toURL().toExternalForm(), inputSource.systemId);

        inputSource = parentSource.getRelative(" /b.txt ");
        assertEquals(new File("/aa/bb/b.txt").toURI().toURL().toExternalForm(), inputSource.systemId);

        inputSource = parentSource.getRelative(" ../b.txt ");
        assertEquals(new File("/aa/b.txt").toURI().normalize().toURL().toExternalForm(), inputSource.systemId);

        inputSource = parentSource.getRelative(" ../../b.txt ");
        assertEquals(new File("/b.txt").toURI().normalize().toURL().toExternalForm(), inputSource.systemId);

        try {
            inputSource = parentSource.getRelative(" ../../../b.txt ");
            fail();
        } catch (IllegalPathException e) {
            assertThat(e, exception("../../../b.txt"));
        }
    }
View Full Code Here

Examples of com.dotcms.repackage.org.xml.sax.InputSource

  private static class DTDResolver implements EntityResolver {
    public InputSource resolveEntity(String publicId, String systemId) {
      String uri = null;
      if (systemId.startsWith("http:")) {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        return new InputSource(cl.getResource("xhtml" + systemId.substring(systemId.lastIndexOf('/'))).getFile());
      } else if (systemId.startsWith("file:")) {
        uri = systemId;
        return new InputSource(uri);
      }
      return null;
    }
View Full Code Here

Examples of com.google.caja.lexer.InputSource

    boolean passed = false;

    MessageQueue mq = new SimpleMessageQueue();
    MessageContext mc = new MessageContext();
    Uri contextUri = req.getUri();
    InputSource is = new InputSource(contextUri.toJavaUri());

    PluginMeta pluginMeta = new PluginMeta(
            proxyFetcher(req, contextUri), proxyUriPolicy(req));
    PluginCompiler compiler = new PluginCompiler(BuildInfo.getInstance(),
            pluginMeta, mq);
View Full Code Here

Examples of com.sun.star.xml.sax.InputSource

                        XParser.class , xSaxParserObj );
    if (xParser==null){
        System.out.println("\nParser creation Failed");
    }
    xOutStream.closeOutput();
    InputSource aInput = new InputSource();
    if (sFileName==null){
      sFileName="";
        }
    aInput.sSystemId = sFileName;
    aInput.aInputStream =xInStream;
View Full Code Here

Examples of davaguine.jmac.info.InputSource

    }

    public static void CompressFile(String pInputFilename, String pOutputFilename, int nCompressionLevel, ProgressCallback progressor) throws IOException, JMACStoppedByUserException {
        // declare the variables
        IAPECompress spAPECompress = null;
        InputSource spInputSource = null;

        try {
            byte[] spBuffer = null;

            WaveFormat WaveFormatEx = new WaveFormat();

            // create the input source
            IntegerPointer nAudioBlocks = new IntegerPointer();
            nAudioBlocks.value = 0;
            IntegerPointer nHeaderBytes = new IntegerPointer();
            nHeaderBytes.value = 0;
            IntegerPointer nTerminatingBytes = new IntegerPointer();
            nTerminatingBytes.value = 0;
            spInputSource = InputSource.CreateInputSource(pInputFilename, WaveFormatEx, nAudioBlocks,
                    nHeaderBytes, nTerminatingBytes);

            // create the compressor
            spAPECompress = IAPECompress.CreateIAPECompress();

            // figure the audio bytes
            int nAudioBytes = nAudioBlocks.value * WaveFormatEx.nBlockAlign;

            // start the encoder
            if (nHeaderBytes.value > 0) spBuffer = new byte[nHeaderBytes.value];
            spInputSource.GetHeaderData(spBuffer);
            spAPECompress.Start(pOutputFilename, WaveFormatEx, nAudioBytes,
                    nCompressionLevel, spBuffer, nHeaderBytes.value);

            // set-up the progress
            ProgressHelper spMACProgressHelper = new ProgressHelper(nAudioBytes, progressor);

            // master loop
            int nBytesLeft = nAudioBytes;

            spMACProgressHelper.UpdateStatus("Process data by compressor");

            while (nBytesLeft > 0) {
                int nBytesAdded = spAPECompress.AddDataFromInputSource(spInputSource, nBytesLeft);

                nBytesLeft -= nBytesAdded;

                // update the progress
                spMACProgressHelper.UpdateProgress(nAudioBytes - nBytesLeft);

                // process the kill flag
                if (spMACProgressHelper.isKillFlag())
                    throw new JMACStoppedByUserException();
            }

            spMACProgressHelper.UpdateStatus("Finishing compression");

            // finalize the file
            if (nTerminatingBytes.value > 0) spBuffer = new byte[nTerminatingBytes.value];
            spInputSource.GetTerminatingData(spBuffer);
            spAPECompress.Finish(spBuffer, nTerminatingBytes.value, nTerminatingBytes.value);

            // update the progress to 100%
            spMACProgressHelper.UpdateStatus("Compression finished");
        } finally {
            // kill the compressor if we failed
            if (spAPECompress != null)
                spAPECompress.Kill();
            if (spInputSource != null)
                spInputSource.Close();
        }
    }
View Full Code Here

Examples of net.jangaroo.jooc.input.InputSource

    ParserOptions parserOptions = new CCRParserOptions();
    jangarooParser = new JangarooParser(parserOptions, new StdOutCompileLog()) {
      @Override
      protected InputSource findSource(String qname) {
        InputSource inputSource = super.findSource(qname);
        if (inputSource != null) {
          // A regular source file (not a generated file) has been found. Use it.
          return inputSource;
        }
        // Just in case the requested class is a class
        // that is generated from an EXML file, regenerate the file before
        // it is too late. This will only affect generated files, so it is pretty safe.
        tryGenerateClass(qname);
        // Just in case the source was not found on the first attempt, fetch it again.
        return super.findSource(qname);
      }
    };
    List<File> fullClassPath = new ArrayList<File>(config.getClassPath());
    fullClassPath.add(config.getOutputDirectory());
    InputSource classPathInputSource = PathInputSource.fromFiles(fullClassPath,
      new String[]{"", JangarooParser.JOO_API_IN_JAR_DIRECTORY_PREFIX}, false);
    jangarooParser.setUp(sourcePathInputSource, classPathInputSource);
    exmlConfigPackageXsdGenerator = new ExmlConfigPackageXsdGenerator();
  }
View Full Code Here

Examples of org.apache.maven.model.InputSource

        problems.setSource( modelSource.getLocation() );
        try
        {
            boolean strict = request.getValidationLevel() >= ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0;
            InputSource source = request.isLocationTracking() ? new InputSource() : null;

            Map<String, Object> options = new HashMap<String, Object>();
            options.put( ModelProcessor.IS_STRICT, Boolean.valueOf( strict ) );
            options.put( ModelProcessor.INPUT_SOURCE, source );
            options.put( ModelProcessor.SOURCE, modelSource );

            try
            {
                model = modelProcessor.read( modelSource.getInputStream(), options );
            }
            catch ( ModelParseException e )
            {
                if ( !strict )
                {
                    throw e;
                }

                options.put( ModelProcessor.IS_STRICT, Boolean.FALSE );

                try
                {
                    model = modelProcessor.read( modelSource.getInputStream(), options );
                }
                catch ( ModelParseException ne )
                {
                    // still unreadable even in non-strict mode, rethrow original error
                    throw e;
                }

                if ( pomFile != null )
                {
                    problems.add( Severity.ERROR, "Malformed POM " + modelSource.getLocation() + ": " + e.getMessage(),
                                  null, e );
                }
                else
                {
                    problems.add( Severity.WARNING, "Malformed POM " + modelSource.getLocation() + ": "
                        + e.getMessage(), null, e );
                }
            }

            if ( source != null )
            {
                source.setModelId( ModelProblemUtils.toId( model ) );
                source.setLocation( modelSource.getLocation() );
            }
        }
        catch ( ModelParseException e )
        {
            problems.add( Severity.FATAL, "Non-parseable POM " + modelSource.getLocation() + ": " + e.getMessage(),
View Full Code Here

Examples of org.bladerunnerjs.plugin.InputSource

          contentPlugin.getValidProdContentPaths(bundleSet);
        ContentPathParser contentPathParser = contentPlugin.getContentPathParser();
       
        for(String requestPath : requestPaths) {
          ParsedContentPath parsedContentPath = contentPathParser.parse(requestPath);
          inputSources.add( new InputSource(parsedContentPath, contentPlugin, bundleSet, contentAccessor, version) );
        }
      }
    }
    catch (MalformedRequestException e) {
      throw new ContentProcessingException(e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.