Package java.io

Examples of java.io.ByteArrayOutputStream.toByteArray()


            if (tlvList != null && !tlvList.isEmpty()) {
                for (Iterator iter = tlvList.iterator(); iter.hasNext();) {
                    baos.write( ((TLV)iter.next()).getBytes() );                   
                }
            }
            data = baos.toByteArray();
        }
       
        ByteArrayOutputStream cmdOS = new ByteArrayOutputStream();
        int cmdDataLen = 0;
        if (snacPacket != null) {
View Full Code Here


        cmdOS.write( flapHdr.getBytes() );
        if (snacPacket != null) {
            cmdOS.write(snacPacket.getBytes());
        }
        cmdOS.write(data, 0, data.length);
        byte[] cmdBytes = cmdOS.toByteArray();
        return cmdBytes;
    }
       

    /**
 
View Full Code Here

                }
            } catch (IOException e) {
                //e.printStackTrace();
            }
           
            tlvBytes = baos.toByteArray();
        }

        return tlvBytes;
    }
   
View Full Code Here

      convertor.parse(fileName, baos, XSLT_FILE);

      XmlConfigurationParser newParser = new XmlConfigurationParser();
      XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();

      Configuration newConfig = newParser.parseStream(new ByteArrayInputStream(baos.toByteArray()));
      Configuration oldConfig = oldParser.parseFile(fileName);

      assert oldConfig.equals(newConfig);
   }
View Full Code Here

         convertor.parse(fileName, baos, XSLT_FILE);

         XmlConfigurationParser newParser = new XmlConfigurationParser();
         XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();

         Configuration newConfig = newParser.parseStream(new ByteArrayInputStream(baos.toByteArray()));
         Configuration oldConfig = oldParser.parseFile(fileName);

         assert newConfig.equals(oldConfig);
      }
   }
View Full Code Here

         convertor.parse(fileName, baos, XSLT_FILE);

         XmlConfigurationParser newParser = new XmlConfigurationParser();
         XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();

         Configuration newConfig = newParser.parseStream(new ByteArrayInputStream(baos.toByteArray()));
         Configuration oldConfig = oldParser.parseFile(fileName);

         assert newConfig.equals(oldConfig);
      }
   }
View Full Code Here

      convertor.parse(fileName, baos, XSLT_FILE);

      XmlConfigurationParser newParser = new XmlConfigurationParser();
      XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();

      Configuration newConfig = newParser.parseStream(new ByteArrayInputStream(baos.toByteArray()));
      Configuration oldConfig = oldParser.parseFile(fileName);

      for (EvictionRegionConfig erc : oldConfig.getEvictionConfig().getEvictionRegionConfigs())
      {
         correctUnlimitedValues(erc);
View Full Code Here

      assertNull(newImpl.get(Fqn.fromString("/a/b/c")));
      assertNull(newImpl.get(Fqn.fromString("/a/b/d")));
      assertNull(newImpl.get(Fqn.fromString("/a/b/e")));
      assertNull(newImpl.get(Fqn.fromString("/a/f/e")));
      assertNull(newImpl.get(Fqn.ROOT));
      ByteArrayInputStream bais = new ByteArrayInputStream(newBaos.toByteArray());
      MarshalledValueInputStream is = new MarshalledValueInputStream(bais);
      newImpl.storeEntireState(is);
      assertEquals(newImpl.get(Fqn.fromString("/a/b/c")).get("key1"), "value1");
      assertEquals(newImpl.get(Fqn.fromString("/a/b/d")).get("key2"), "value2");
      assertEquals(newImpl.get(Fqn.fromString("/a/b/e")).get("key3"), "value3");
View Full Code Here

      assertNull(newImpl.get(Fqn.fromString("/a/b/c")));
      assertNull(newImpl.get(Fqn.fromString("/a/b/d")));
      assertNull(newImpl.get(Fqn.fromString("/a/b/e")));
      assertNull(newImpl.get(Fqn.fromString("/a/b")));

      ByteArrayInputStream bais = new ByteArrayInputStream(newBaos.toByteArray());
      MarshalledValueInputStream is = new MarshalledValueInputStream(bais);
      newImpl.storeState(Fqn.fromString("/a/b"), is);

      assertEquals(newImpl.get(Fqn.fromString("/a/b/c")).get("key1"), "value1");
      assertEquals(newImpl.get(Fqn.fromString("/a/b/d")).get("key2"), "value2");
View Full Code Here

      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(baos);
      oos.writeObject(lock);
      oos.close();
      baos.close();
      ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
      OwnableReentrantLock l2 = (OwnableReentrantLock) ois.readObject();

      assert !l2.isLocked();
      assert l2.getOwner() == null;
   }
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.