Package java.io

Examples of java.io.StringBufferInputStream


    File outFile = AvroTestUtil.tempFile(
        TestDataFileTools.class + "." + testName + ".avro");
    FileOutputStream fout = new FileOutputStream(outFile);
    PrintStream out = new PrintStream(fout);
    new DataFileWriteTool().run(
        new StringBufferInputStream(json),
        new PrintStream(out), // stdout
        null, // stderr
        Arrays.asList("-schema", schema, "-"));
    out.close();
    fout.close();
View Full Code Here


        AxisServer server = new AxisServer(provider);
       
        Handler handler = server.getHandler("other");
        assertNotNull("Couldn't get handler", handler);

        InputStream is = new StringBufferInputStream(undeployDoc);
        WSDDDocument doc = new WSDDDocument(XMLUtils.newDocument(is));

        WSDDDeployment dep = provider.getDeployment();
        doc.deploy(dep);
View Full Code Here

                                content.append(lineSeparator);
                            }
                        }

                        return flavor.equals(DataFlavor.stringFlavor) ? (Object)content.toString()
                                                                      : new StringBufferInputStream(content.toString());
                    }

                    throw new UnsupportedFlavorException(flavor);
                }
View Full Code Here

      stream.write(template2.getBytes());
      stream.flush();
      stream.close();
      filesToDelete.add(file);
     
      StringBufferInputStream sbis=new StringBufferInputStream(template2);
      JasperCompileManager.compileReportToFile(dirS + File.separatorChar + "Master.jrxml",dirS + File.separatorChar + "Master.jasper");

      logger.debug("Filling report ...");
      Context ctx = new InitialContext();
      Session aSession = HibernateUtil.currentSession();
View Full Code Here

        if (String.class.equals(flavor.getRepresentationClass())) {
          return data;
        } else if (Reader.class.equals(flavor.getRepresentationClass())) {
          return new StringReader(data);
        } else if (InputStream.class.equals(flavor.getRepresentationClass())) {
          return new StringBufferInputStream(data);
        }
        // fall through to unsupported
      } else if (isStringFlavor(flavor)) {
        String data = getPlainData();
        data = (data == null) ? "" : data;
View Full Code Here

    {
        String code = control.getSourceCode();
        try
        {
            //TODO fix depricated method
            InputStream iStream = new StringBufferInputStream(code);
            ANTLRInputStream input = new ANTLRInputStream(iStream);
            JavaBranchLexer lexer = new JavaBranchLexer(input);
            CommonTokenStream tokens = new CommonTokenStream(lexer);
            JavaBranchParser jParser = new JavaBranchParser(tokens, this);
            jParser.compilationUnit();
View Full Code Here

            } else if (Reader.class.equals(flavor.getRepresentationClass()))
            {
                return new StringReader(html);
            } else if (InputStream.class.equals(flavor.getRepresentationClass()))
            {
                return new StringBufferInputStream(html);
            }

            throw new UnsupportedFlavorException(flavor);
        }
View Full Code Here

          LogicalMessage msg = messagecontext.getMessage();
          String st = getStringFromSourcePayload(msg.getPayload());
          String txt = String.valueOf(Integer.valueOf(getFirstArg(st)) - 1);
          st = replaceFirstArg(st, txt);
          msg.setPayload(new StreamSource(new StringBufferInputStream(st)));

        } else // inbound request on the server
         
          // this is the second server inbound hit
           
            // turn off special property that logs ability to use
            // both SOAPHeadersAdapter and SAAJ in a single handler method:
            messagecontext.put(org.apache.axis2.jaxws.handler.Constants.JAXWS_HANDLER_TRACKER, false);
         
          // let's check for all the headers we expect, remove them, and manipulate the message payload
         
          Map<QName, List<String>> requestHeaders = (Map<QName, List<String>>)messagecontext.get(Constants.JAXWS_INBOUND_SOAP_HEADERS);
          headerUtil.confirmHeadersAdapterList(Constants.JAXWS_INBOUND_SOAP_HEADERS, requestHeaders, 2);

          // expecting two header elements under two different QNames
         
          List<String> list1 = requestHeaders.get(TestHeaders.ACOH3_HEADER_QNAME);
          headerUtil.confirmList(TestHeaders.ACOH3_HEADER_QNAME, list1, 1);
          String acoh1 = TestHeaders.createHeaderXMLString(TestHeaders.ACOH3_HEADER_QNAME, TestHeaders.CONTENT_LARGE);
          headerUtil.compareHeaderStrings(acoh1, list1.get(0));
          tracker.checkHeader(list1.get(0));

          List<String> list2 = requestHeaders.get(TestHeaders.ACOH4_HEADER_QNAME);
          headerUtil.confirmList(TestHeaders.ACOH4_HEADER_QNAME, list2, 1);
          String acoh4 = TestHeaders.createHeaderXMLString(TestHeaders.ACOH4_HEADER_QNAME, TestHeaders.CONTENT_SMALL4);
          headerUtil.compareHeaderStrings(acoh4, list2.get(0));
          tracker.checkHeader(list2.get(0));

          // remove the headers before continuing
          tracker.removedHeader(acoh1);
          requestHeaders.remove(TestHeaders.ACOH3_HEADER_QNAME);
         
          // manipulate the payload between header removals just to be thorough
         
          /*
           * NOTE: This is an important test!  The get of a header from the SOAPHeadersAdapter triggers a
           * parse of the header OM element, which previously marked the parser as 'done'.  This caused the
           * below getPayload() to throw an OMException.  This only occurred on server inbound in this
           * scenario, so this implementation MUST REMAIN.  See top of XMLStringBlockImpl._getBOFromReader
           * for the fix.
           */
         
          LogicalMessage msg = messagecontext.getMessage();
          String st = getStringFromSourcePayload(msg.getPayload());
          String txt = String.valueOf(Integer.valueOf(getFirstArg(st)) - 1);
          st = replaceFirstArg(st, txt);
          msg.setPayload(new StreamSource(new StringBufferInputStream(st)));
         
          tracker.removedHeader(acoh4);
          requestHeaders.remove(TestHeaders.ACOH4_HEADER_QNAME);

          if (st.contains("66")) {
View Full Code Here

          // manipulate the payload just to be thorough
          LogicalMessage msg = messagecontext.getMessage();
          String st = getStringFromSourcePayload(msg.getPayload());
          String txt = String.valueOf(Integer.valueOf(getFirstArg(st)) - 1);
          st = replaceFirstArg(st, txt);
          msg.setPayload(new StreamSource(new StringBufferInputStream(st)));

        } else {
          // TODO implement some inbound stuff
         
          // this is the third client inbound hit
View Full Code Here

                tracker.log("THROWING PROTOCOLEXCEPTION", outbound);
                throw new ProtocolException("I don't like the value 99");
            }
            String txt = String.valueOf(Integer.valueOf(getFirstArg(st)) - 1);
            st = replaceFirstArg(st, txt);
            msg.setPayload(new StreamSource(new StringBufferInputStream(st)));
           
            messagecontext.put("AddNumbersLogicalHandlerInboundAppScopedProperty", "blargval");
            messagecontext.setScope("AddNumbersLogicalHandlerInboundAppScopedProperty",
                                    Scope.APPLICATION);
            messagecontext.put("AddNumbersLogicalHandlerInboundHandlerScopedProperty",
                               "blargval");
           
            // Check for the presences of the attachment property
            String propKey = MessageContext.INBOUND_MESSAGE_ATTACHMENTS;
            Map map = (Map) messagecontext.get(propKey);
            if (map == null) {
                throw new RuntimeException("Property " + propKey + " was null");
            }
            if (!(map instanceof AttachmentsAdapter)) {
                throw new RuntimeException("Expected AttachmentAdapter for Property " +
                                           propKey);
            }

        } else { // outbound response if we're on the server
            LogicalMessage msg = messagecontext.getMessage();
            String st = getStringFromSourcePayload(msg.getPayload());
            String txt = String.valueOf(Integer.valueOf(getFirstArg(st)) - deduction);
            st = replaceFirstArg(st, txt);
            msg.setPayload(new StreamSource(new StringBufferInputStream(st)));
           
            // Check for the presences of the attachment property
            String propKey = MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS;
            Map map = (Map) messagecontext.get(propKey);
            if (map == null) {
View Full Code Here

TOP

Related Classes of java.io.StringBufferInputStream

Copyright © 2018 www.massapicom. 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.