Package java.io

Examples of java.io.ByteArrayOutputStream.toByteArray()


      body = null;
    } else {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      AbstractAdminMessage.write(adminMsg, baos);
      baos.flush();
      body = baos.toByteArray();
      baos.close();
    }
  }

  /**
 
View Full Code Here


      in = new BufferedInputStream(new FileInputStream(file), 0x4000);
      ByteArrayOutputStream out = new ByteArrayOutputStream((int) file.length());
      IOUtilities.pipeStreams(in, out);
      out.close();

      byte[] data = out.toByteArray();

      mBytesRead += data.length;
     
      return data;
    }
View Full Code Here

    h.put("classname", getClass().getName());

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    writeTo(baos);
    baos.flush();
    h.put("bytecontent", baos.toByteArray());
    baos.close();

    return h;
  }
View Full Code Here

    h.put("classname", getClass().getName());

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    writeTo(baos);
    baos.flush();
    h.put("bytecontent", baos.toByteArray());
    baos.close();

    return h;
  }
View Full Code Here

          ObjectOutputStream oos = new ObjectOutputStream(os);
          try {
            oos.writeObject(so);
            w.write(aname);
            w.write(":");
            w.write(Utils.base64Encode(os.toByteArray()));
            w.write("\r\n");
          } catch (IOException ioe) {
            servletContext.log(
                "TJWS: Can't replicate/store a session value of '"
                    + aname + "' class:"
View Full Code Here

    h.put("classname", getClass().getName());

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    writeTo(baos);
    baos.flush();
    h.put("bytecontent", baos.toByteArray());
    baos.close();

    return h;
  }
View Full Code Here

        ByteArrayOutputStream output=new ByteArrayOutputStream();
        DataOutputStream out=new DataOutputStream(output);
        m1.writeTo(out);
        out.close();
        tmp=output.toByteArray();
        output.close();

        ByteArrayInputStream input=new ByteArrayInputStream(tmp);
        DataInputStream in=new DataInputStream(input);
        Message m3, m4;
View Full Code Here

        output=new ByteArrayOutputStream();
        out=new DataOutputStream(output);
        // out.writeObject(m2);
        m2.writeTo(out);
        out.close();
        tmp=output.toByteArray();
        output.close();

        System.out.println("-- serialized buffer is " + tmp.length + " bytes");

        input=new ByteArrayInputStream(tmp);
View Full Code Here

        ByteArrayOutputStream output=new ByteArrayOutputStream();
        DataOutputStream out=new DataOutputStream(output);
        msg.writeTo(out);
        out.close();
        tmp=output.toByteArray();
        output.close();

        System.out.println("-- serialized buffer is " + tmp.length + " bytes");

        ByteArrayInputStream input=new ByteArrayInputStream(tmp);
View Full Code Here

        Renderer jspRenderer = XhtmlRendererFactory.getRenderer(rendererName);
        if (jspRenderer != null) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            jspRenderer.highlight(name, input, bos, encoding, true);

            ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());

            Tokenizer tokenizer = new Tokenizer(new InputStreamReader(bis, encoding));
            tokenizer.addSymbol(new TokenizerSymbol("EOL", "\n", null, false, false, true, false));
            tokenizer.addSymbol(new TokenizerSymbol("EOL", "\r\n", null, false, false, true, false));
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.