Package java.io

Examples of java.io.ByteArrayOutputStream.toByteArray()


      os = new MarshalledValueOutputStream(baos);
      loader.loadEntireState(os);
      cache.getMarshaller().objectToObjectStream(DefaultStateTransferManager.STREAMING_DELIMITER_NODE, os);
      os.close();

      bais = new ByteArrayInputStream(baos.toByteArray());
      is = new MarshalledValueInputStream(bais);
      loader.storeEntireState(is);
      is.close();

      baos = new ByteArrayOutputStream(1024);
View Full Code Here


      loader.loadEntireState(os);
      cache.getMarshaller().objectToObjectStream(DefaultStateTransferManager.STREAMING_DELIMITER_NODE, os);
      assertTrue(baos.size() > STREAM_HEADER_LENGTH);
      os.close();

      byte[] savedState = baos.toByteArray();

      /* Clear state. */
      baos = new ByteArrayOutputStream(1024);
      os = new MarshalledValueOutputStream(baos);
      cache.getMarshaller().objectToObjectStream(DefaultStateTransferManager.STREAMING_DELIMITER_NODE, os);
View Full Code Here

      /* Clear state. */
      baos = new ByteArrayOutputStream(1024);
      os = new MarshalledValueOutputStream(baos);
      cache.getMarshaller().objectToObjectStream(DefaultStateTransferManager.STREAMING_DELIMITER_NODE, os);
      os.close();
      bais = new ByteArrayInputStream(baos.toByteArray());
      is = new MarshalledValueInputStream(bais);
      loader.storeEntireState(is);
      is.close();

      assertEquals(null, loader.get(FQN));
View Full Code Here

      m.writeUnsignedInt(oos, i);
      oos.flush();
      oos.close();
      baos.flush();
      baos.close();
      byte[] bytes = baos.toByteArray();
      int byteL = bytes.length;
      assert i == m.readUnsignedInt(new ObjectInputStream(new ByteArrayInputStream(bytes)));
      return byteL;
   }
View Full Code Here

      m.writeUnsignedLong(oos, i);
      oos.flush();
      oos.close();
      baos.flush();
      baos.close();
      byte[] bytes = baos.toByteArray();
      int byteL = bytes.length;
      assert i == m.readUnsignedLong(new ObjectInputStream(new ByteArrayInputStream(bytes)));
      return byteL;
   }
}
View Full Code Here

            }

            public void write(byte b) throws IOException {
                buff.write(b);
                if (b == '\n') {
                    byte[] data = buff.toByteArray();
                    String line = new String(data, "UTF-8");
                    boolean print = true;
                    for (String l : exclude) {
                        if (line.startsWith(l)) {
                            print = false;
View Full Code Here

            }
            in.close();
        } catch (IOException e) {
            throw new RuntimeException("Error downloading " + fileURL + " to " + target, e);
        }
        byte[] data = buff.toByteArray();
        String got = getSHA1(data);
        if (sha1Checksum == null) {
            println("SHA1 checksum: " + got);
        } else {
            if (!got.equals(sha1Checksum)) {
View Full Code Here

      ObjectOutputStream out = new ObjectOutputStream(bout);
      byte[] s = {1, 2, 3, 4};
      m.objectToObjectStream(s, out);
      out.close();

      ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
      ObjectInputStream ois = new ObjectInputStream(bin);

      Object o = m.objectFromObjectStream(ois);

      ois.close();
View Full Code Here

      ObjectOutputStream out = new ObjectOutputStream(bout);
      Byte[] s = new Byte[]{1, 2, 3, 4};
      m.objectToObjectStream(s, out);
      out.close();

      ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
      ObjectInputStream ois = new ObjectInputStream(bin);

      Object o = m.objectFromObjectStream(ois);

      ois.close();
View Full Code Here

      ObjectOutputStream out = new ObjectOutputStream(bout);
      Object[] s = {"Hello", Fqn.fromString("/a"), 1, null};
      m.objectToObjectStream(s, out);
      out.close();

      ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
      ObjectInputStream ois = new ObjectInputStream(bin);

      Object o = m.objectFromObjectStream(ois);

      ois.close();
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.