Examples of PipedInputStream


Examples of java.io.PipedInputStream

               ps.setString(1, "someName");
               byte[] blob = new byte[4096];
               int sweeps = 10240; // 40 MB

               int length = blob.length * sweeps;
               PipedInputStream pi = new PipedInputStream();
               PipedOutputStream po = new PipedOutputStream(pi);
               ps.setBinaryStream(2, pi, length);

               Pusher pusher = new Pusher(sweeps, blob, po);
               pusher.start();
View Full Code Here

Examples of java.io.PipedInputStream

  }

  //-----------------------------------------------------------

  public void put (String sFile) throws IOException {
    oInPipe = new PipedInputStream();
    sPar1 = sFile;
    iCmd = PUT_PIPE;
  } // put()
View Full Code Here

Examples of java.io.PipedInputStream

  private void parse(StreamSource source, String baseURI)
    throws IOException, RDFParseException, RDFHandlerException
  {
    CountDownLatch latch = new CountDownLatch(1);
    PipedInputStream pipe = new PipedInputStream();
    PipedOutputStream out = new PipedOutputStream(pipe);

    try {
      parse(pipe, baseURI, latch);
View Full Code Here

Examples of java.io.PipedInputStream

            try {
               if (isFirstChunk(updQos)) {
                  this.mutex.acquire();
                  this.cbSessionId = cbSessId;
                  this.out = new PipedOutputStream();
                  this.in = new PipedInputStream(this.out);
                  ExecutionThread thread = new ExecutionThread(cbSessId, updKey, cont, updQos);
                  thread.start();
               }
               else { // check if the message is complete
                  /*
 
View Full Code Here

Examples of java.io.PipedInputStream

            MsgUnitRaw msg = new MsgUnitRaw(null, content, qos);
            msgInfo.addMessage(msg);
            byte[] raw = parser.createRawMsg(msgInfo);
            System.out.println(parser.toLiteral(raw));

            PipedInputStream in = new PipedInputStream();
            PipedOutputStream out = new PipedOutputStream(in);
            out.write(raw);
            out.flush();
            out.close();
            MsgInfo msgInfoNew = parser.parse(in)[0];
            byte[] rawNew = parser.createRawMsg(msgInfoNew);
            System.out.println("Parsed and dumped again:" + parser.toLiteral(rawNew));
         }
         {
            System.out.println("TEST1 SHOULD FORCE BASE64");
            parser.init(glob, null, null);
            MsgInfo msgInfo = new MsgInfo(glob, MsgInfo.INVOKE_BYTE, "12",
                  MethodName.PUBLISH, "secret", null);
            byte[] content = "hello&bye]]>".getBytes();
            //content[3] = 0;
            MsgUnitRaw msg = new MsgUnitRaw("<key oid='hello'/>", content, "<qos></qos>");
            msgInfo.addMessage(msg);
            byte[] raw = parser.createRawMsg(msgInfo);
            System.out.println("Initial creation:" + parser.toLiteral(raw));

            PipedInputStream in = new PipedInputStream();
            PipedOutputStream out = new PipedOutputStream(in);
            out.write(raw);
            out.flush();
            out.close();
            MsgInfo msgInfoNew = parser.parse(in)[0];
            byte[] rawNew = parser.createRawMsg(msgInfoNew);
            System.out.println("Parsed and dumped again:" + parser.toLiteral(rawNew));
         }
         {
            System.out.println("TEST2 SHOULD KEEP LITERAL STRING");
            parser.init(glob, null, null);
            MsgInfo msgInfo = new MsgInfo(glob, MsgInfo.INVOKE_BYTE, "12",
                  MethodName.PUBLISH, "secret", null);
            byte[] content = "Hello World!".getBytes();
            MsgUnitRaw msg = new MsgUnitRaw("<key oid='hello'/>", content, "<qos></qos>");
            msgInfo.addMessage(msg);
            byte[] raw = parser.createRawMsg(msgInfo);
            System.out.println("Initial creation:" + parser.toLiteral(raw));

            PipedInputStream in = new PipedInputStream();
            PipedOutputStream out = new PipedOutputStream(in);
            out.write(raw);
            out.flush();
            out.close();
            MsgInfo msgInfoNew = parser.parse(in)[0];
View Full Code Here

Examples of java.io.PipedInputStream

 
    final DataSource ds = processor.getDataOutput();

    final DataSink[] streamDataSinkHolder = new DataSink[] {null};
    // connect the data output of the processor to a StreamDataSink, which will make the data available to PipedInputStream, which we return.
    final PipedInputStream in = new PipedInputStream() {

      // override close to clean up everything when the media has been served.
      @Override
      public void close() throws IOException
      {
View Full Code Here

Examples of java.io.PipedInputStream

        .getResourceAsStream("samples/example-sld.xml"), null);

    // pipe to geotools parser
    StyleFactory factory = CommonFactoryFinder.getStyleFactory(null);
    PipedOutputStream pos = new PipedOutputStream();
    PipedInputStream pii = new PipedInputStream(pos);

    final SLDParser parser = new SLDParser(factory, pii);

    IMarshallingContext mctx = bfact.createMarshallingContext();
    mctx.setOutput(new PrintWriter(pos));
View Full Code Here

Examples of java.io.PipedInputStream

        server.start();
       
        HttpClient httpClient = new HttpClient();

        PipedOutputStream pos = new PipedOutputStream();
        PipedInputStream pis = new PipedInputStream(pos);

        pos.write("Hello ".getBytes());
       
        FutureResponseHandler respHdl = new FutureResponseHandler();
        httpClient.send(new HttpRequest(new HttpRequestHeader("POST", "http://localhost:" + server.getLocalPort() + "/", "text/plain"), pis), respHdl);
View Full Code Here

Examples of java.io.PipedInputStream

        server.start();
       
        HttpClient httpClient = new HttpClient();

        PipedOutputStream pos = new PipedOutputStream();
        PipedInputStream pis = new PipedInputStream(pos);

        pos.write("Hello ".getBytes());
       
        FutureResponseHandler respHdl = new FutureResponseHandler();
        httpClient.send(new HttpRequest(new HttpRequestHeader("POST", "http://localhost:" + server.getLocalPort() + "/", "text/plain"), pis), respHdl);
View Full Code Here

Examples of java.io.PipedInputStream

        int readNow;
        int readBlocks = (int) (dataSize / 512L);
        int modulus    = (int) (dataSize % 512L);

        // Couldn't care less about the entry "name" field.
        PipedInputStream  inPipe  = null;
        PipedOutputStream outPipe = new PipedOutputStream();

        /* This constructor not available until Java 1.6:
                new PipedInputStream(outPipe, (int) dataSize);
        */
        try {
            inPipe = new PipedInputStream(outPipe);
            while (readBlocks > 0) {
                readNow = (readBlocks > archive.getReadBufferBlocks())
                          ? archive.getReadBufferBlocks()
                          : readBlocks;

                archive.readBlocks(readNow);

                readBlocks -= readNow;

                outPipe.write(archive.readBuffer, 0, readNow * 512);
            }

            if (modulus != 0) { archive.readBlock();
                outPipe.write(archive.readBuffer, 0, modulus);
            }

            outPipe.flush();    // Do any good on a pipe?
        } catch (IOException ioe) {
            if (inPipe != null) {
                inPipe.close();
            }

            throw ioe;
        } finally {
            try {
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.