Package org.jboss.virtual

Examples of org.jboss.virtual.VirtualFile.openStream()


      VirtualFile jar2 = outerjar.findChild("jar2.jar");
      assertTrue("outer.jar/jar2.jar != null", jar2 != null);

      VirtualFile jar1MF = jar1.findChild("META-INF/MANIFEST.MF");
      assertNotNull("jar1!/META-INF/MANIFEST.MF", jar1MF);
      InputStream mfIS = jar1MF.openStream();
      Manifest mf1 = new Manifest(mfIS);
      Attributes mainAttrs1 = mf1.getMainAttributes();
      String title1 = mainAttrs1.getValue(Attributes.Name.SPECIFICATION_TITLE);
      assertEquals("jar1", title1);
      jar1MF.close();
View Full Code Here


      jar1MF.close();

      VirtualFile jar1DS = serializeDeserialize(jar1, VirtualFile.class);
      assertNotNull("jar1 deserialized", jar1DS);
      VirtualFile jar1DSMF = jar1.findChild("META-INF/MANIFEST.MF");
      mfIS = jar1DSMF.openStream();
      mf1 = new Manifest(mfIS);
      mainAttrs1 = mf1.getMainAttributes();
      title1 = mainAttrs1.getValue(Attributes.Name.SPECIFICATION_TITLE);
      assertEquals("jar1", title1);
      jar1DSMF.close();
View Full Code Here

      VirtualFile jar1 = outerjar.findChild("jar1-filesonly.jar");
      assertTrue("outer.jar/jar1-filesonly.jar != null", jar1 != null);

      VirtualFile jar1MF = jar1.findChild("META-INF/MANIFEST.MF");
      assertNotNull("jar1-filesonly!/META-INF/MANIFEST.MF", jar1MF);
      InputStream mfIS = jar1MF.openStream();
      Manifest mf1 = new Manifest(mfIS);
      Attributes mainAttrs1 = mf1.getMainAttributes();
      String title1 = mainAttrs1.getValue(Attributes.Name.SPECIFICATION_TITLE);
      assertEquals("jar1-filesonly", title1);
      jar1MF.close();
View Full Code Here

      VirtualFile jar1DS = serializeDeserialize(jar1, VirtualFile.class);
      assertNotNull("jar1 deserialized", jar1DS);
      VirtualFile jar1DSMF = jar1DS.getChild("META-INF/MANIFEST.MF");
      assertNotNull("jar1-filesonly!/META-INF/MANIFEST.MF", jar1DSMF);
      mfIS = jar1DSMF.openStream();
      mf1 = new Manifest(mfIS);
      mainAttrs1 = mf1.getMainAttributes();
      title1 = mainAttrs1.getValue(Attributes.Name.SPECIFICATION_TITLE);
      assertEquals("jar1-filesonly", title1);
      jar1DSMF.close();
View Full Code Here

      // Verify it via VFS
      File root = new File(".");
      VirtualFile vf = VFS.getVirtualFile(root.toURI().toURL(), "test.jar");
      {
         VirtualFile manifestFile = vf.findChild("META-INF/MANIFEST.MF");
         Manifest manifest = new Manifest(manifestFile.openStream());
         String actual = manifest.getMainAttributes().getValue("test");
         assertEquals("v1", actual);
      }
     
      // If we don't delete, we get a corrupt zip entries iterator on linux
View Full Code Here

      }
     
      // Verify the manifest the VFS way
      {
         VirtualFile manifestFile = vf.findChild("META-INF/MANIFEST.MF");
         Manifest manifest = new Manifest(manifestFile.openStream());
         String actual = manifest.getMainAttributes().getValue("test");
         assertEquals("VFS found the wrong manifest", "v2", actual);
      }

      // Verify again - through new context
View Full Code Here

      // Verify again - through new context
      {
         vf = VFS.getVirtualFile(root.toURI().toURL(), "test.jar");
         VirtualFile manifestFile = vf.findChild("META-INF/MANIFEST.MF");
         Manifest manifest = new Manifest(manifestFile.openStream());
         String actual = manifest.getMainAttributes().getValue("test");
         assertEquals("VFS found the wrong manifest", "v2", actual);
      }
   }
}
View Full Code Here

        
         String read = readURL(url);
         assertEquals("abc", read);

         VirtualFile classFile = VFS.getVirtualFile(new URL("vfsmemory://aopdomain"), "org/acme/test/Test.class");
         InputStream bis = classFile.openStream();
         read = readIS(bis);
         assertEquals("abc", read);
         assertEquals(3, classFile.getSize());
         assertTrue(classFile.exists());
         assertTrue(classFile.isLeaf());
View Full Code Here

   public void testInputStream() throws Exception
   {
      VirtualFile file = getFile();
      URL url = file.toURL();
      URLConnection conn = url.openConnection();
      assertTrue(Arrays.equals(readBytes(file.openStream()), readBytes(conn.getInputStream())));
   }

   protected static byte[] readBytes(InputStream inputStream) throws Exception
   {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
View Full Code Here

     
      // first we ask for a jar:file: resource
     
      VirtualFile manifest = VFS.getRoot(manifestURL);
     
      InputStream in = manifest.openStream();
      in.close();
     
      in = manifest.toURL().openStream();
      in.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.