Package java.io

Examples of java.io.ByteArrayInputStream


         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

      cache.getMarshaller().objectToObjectStream(DefaultStateTransferManager.STREAMING_DELIMITER_NODE, os);
      //os.close();
      assertTrue(baos.size() > 0);
      loader.remove(X);

      ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
      MarshalledValueInputStream is = new MarshalledValueInputStream(bais);
      loader.storeEntireState(is);
      //is.close();
      assertEquals("X found", true, loader.exists(X));
      loader.remove(X);
View Full Code Here

                dataOut.writeInt(len);
                len -= 4;
                byte[] data = new byte[len];
                dataIn.readFully(data, 0, len);
                dataOut.write(data);
                dataIn = new DataInputStream(new ByteArrayInputStream(data, 0, len));
                int version = dataIn.readInt();
                if (version == 80877102) {
                    println("CancelRequest");
                    println(" pid: " + dataIn.readInt());
                    println(" key: " + dataIn.readInt());
                } else if (version == 80877103) {
                    println("SSLRequest");
                } else {
                    println("StartupMessage");
                    println(" version " + version + " (" + (version >> 16) + "." + (version & 0xff) + ")");
                    while (true) {
                        String param = readStringNull(dataIn);
                        if (param.length() == 0) {
                            break;
                        }
                        String value = readStringNull(dataIn);
                        println(" param " + param + "=" + value);
                    }
                }
            } else {
                int x = dataIn.read();
                if (x < 0) {
                    println("end");
                    return false;
                }
                // System.out.println(" x=" + (char)x+" " +x);
                dataOut.write(x);
                int len = dataIn.readInt();
                dataOut.writeInt(len);
                len -= 4;
                byte[] data = new byte[len];
                dataIn.readFully(data, 0, len);
                dataOut.write(data);
                dataIn = new DataInputStream(new ByteArrayInputStream(data, 0, len));
                switch (x) {
                case 'B': {
                    println("Bind");
                    println(" destPortal: " + readStringNull(dataIn));
                    println(" prepName: " + readStringNull(dataIn));
View Full Code Here

            dataOut.writeInt(len);
            len -= 4;
            byte[] data = new byte[len];
            dataIn.readFully(data, 0, len);
            dataOut.write(data);
            dataIn = new DataInputStream(new ByteArrayInputStream(data, 0, len));
            switch (x) {
            case 'R': {
                println("Authentication");
                int value = dataIn.readInt();
                if (value == 0) {
View Full Code Here

      return null;
   }

   private Container toContainer(String xml) throws Exception
   {
      ByteArrayInputStream is = new ByteArrayInputStream(xml.getBytes());
      IBindingFactory bfact = BindingDirectory.getFactory(Container.class);
      IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
      return (Container)uctx.unmarshalDocument(is, null);
   }
View Full Code Here

TOP

Related Classes of java.io.ByteArrayInputStream

Copyright © 2018 www.massapicom. 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.