Package java.io

Examples of java.io.ByteArrayOutputStream.reset()


      encoder.encode(s, 0, s.length(), baos);
      baos.flush();
      byte[] b1 = baos.toByteArray();

      //
      baos.reset();
      OutputStreamWriter osw = new OutputStreamWriter(baos);
      osw.write(s);
      osw.close();
      byte[] b2 = baos.toByteArray();
View Full Code Here


              boolean success = scrapeUDP( reqUrl, message, hashesForUDP, !auto_probe );
             
              if((!success || message.size() == 0) && !protocol.equalsIgnoreCase("udp"))
              { // automatic UDP probe failed, use HTTP again
                udpScrapeURL = null;
                message.reset();
                if(autoUDPscrapeEvery < 16)
                  autoUDPscrapeEvery <<= 1;
              if (Logger.isEnabled())
                Logger.log(new LogEvent(LOGID, LogEvent.LT_INFORMATION, "redirection of http scrape ["+scrapeURL+"] to udp failed, will retry in "+autoUDPscrapeEvery+" scrapes"));
              } else if(success && !protocol.equalsIgnoreCase("udp"))
View Full Code Here

                        }
                    }
                    if (print) {
                        out.write(data);
                    }
                    buff.reset();
                }
            }

            public void close() throws IOException {
                write('\n');
View Full Code Here

                    maxLines--;
                    lastNewline = true;
                    byte[] data = buff.toByteArray();
                    String s = new String(data);
                    lines.add(s);
                    buff.reset();
                }
                continue;
            }
            if (lastNewline) {
                lastNewline = false;
View Full Code Here

      ByteArrayOutputStream os = new ByteArrayOutputStream(1024 * 16);
      while (e.hasMoreElements()) {
        String aname = (String) e.nextElement();
        Object so = get(aname);
        if (so instanceof Serializable) {
          os.reset();
          ObjectOutputStream oos = new ObjectOutputStream(os);
          try {
            oos.writeObject(so);
            w.write(aname);
            w.write(":");
View Full Code Here

    /** {@inheritDoc} */
    public void outputComplete() {
        if (m_ctx != null && m_attributeName != null) {
            ByteArrayOutputStream baos = (ByteArrayOutputStream) m_copyStream;
            m_ctx.setAttribute(m_attributeName, baos.toByteArray());
            baos.reset();
        }
    }
}
View Full Code Here

    /** {@inheritDoc} */
    public void inputComplete() {
        if (m_ctx != null && m_attributeName != null) {
            ByteArrayOutputStream baos = ((ByteArrayOutputStream)m_os);
            m_ctx.setAttribute(m_attributeName, baos.toByteArray());
            baos.reset();
        }
    }
}
View Full Code Here

        oos.close();
      } catch (Exception exc) {}
    }

    // gets all pending messages
    baos.reset();
    oos = new ObjectOutputStream(baos);
    try {
      if (logmon.isLoggable(BasicLevel.DEBUG)) {
        for (int i=0; i<qinFromExt.size(); i++) {
          Message msg = (Message) qinFromExt.elementAt(i);
View Full Code Here

                OutputStream out2 = CompressTool.wrapOutputStream(out, a, "test");
                IOUtils.copy(new ByteArrayInputStream(buff), out2);
                out2.close();
                InputStream in = new ByteArrayInputStream(out.toByteArray());
                in = CompressTool.wrapInputStream(in, a, "test");
                out.reset();
                IOUtils.copy(in, out);
                assertEquals(buff, out.toByteArray());
            }
        }
    }
View Full Code Here

      List intList = new ArrayList();
      intList.add(intValues[0]);
      intList.add(intValues[1]);
      wrapper.setValue(intList);
      out.reset();
      wrapper.marshal(out);
      assertEquals(expected, out.toByteArray());

      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.