Package org.jboss.virtual.spi

Examples of org.jboss.virtual.spi.VirtualFileHandler.openStream()


   public void testOpenStream() throws Exception
   {
      VFSContext context = getVFSContext("simple");
      VirtualFileHandler root = context.getRoot();
      VirtualFileHandler child = context.findChild(root, "child");
      InputStream stream = child.openStream();
      try
      {
         byte[] contents = new byte[10];
         int read = stream.read(contents);
         int total = 0;
View Full Code Here


      VirtualFileHandler root = context.getRoot();
      VirtualFileHandler child = context.findChild(root, "child");
      child.close();
      try
      {
         child.openStream();
         fail("Should not be here!");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalStateException.class, t);
View Full Code Here

   public void testOpenStream() throws Exception
   {
      VFSContext context = getVFSContext("simple");
      VirtualFileHandler root = context.getRoot();
      VirtualFileHandler child = context.getChild(root, "child");
      InputStream stream = child.openStream();
      try
      {
         byte[] contents = new byte[10];
         int read = stream.read(contents);
         int total = 0;
View Full Code Here

      VirtualFileHandler root = context.getRoot();
      VirtualFileHandler child = context.getChild(root, "child");
      child.close();
      try
      {
         child.openStream();
         fail("Should not be here!");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalStateException.class, t);
View Full Code Here

      VirtualFileHandler e1 = njfs.getChild("org/jboss/test/vfs/support/jar1/ClassInJar1.class");
      assertNotNull(e1);
      log.info("org/jboss/test/vfs/support/CommonClass.class: "+e1);
      VirtualFileHandler mfe1 = njfs.getChild("META-INF/MANIFEST.MF");
      assertNotNull("jar1!/META-INF/MANIFEST.MF", mfe1);
      InputStream mfIS = mfe1.openStream();
      Manifest mf = new Manifest(mfIS);
      Attributes mainAttrs = mf.getMainAttributes();
      String title1 = mainAttrs.getValue(Attributes.Name.SPECIFICATION_TITLE);
      assertEquals("jar1", title1);
      mfIS.close();
View Full Code Here

      VirtualFileHandler e2 = njfs2.getChild("org/jboss/test/vfs/support/jar2/ClassInJar2.class");
      assertNotNull(e2);
      log.info("org/jboss/test/vfs/support/CommonClass.class: "+e2);
      VirtualFileHandler mfe2 = njfs2.getChild("META-INF/MANIFEST.MF");
      assertNotNull("jar2!/META-INF/MANIFEST.MF", mfe2);
      InputStream mf2IS = mfe2.openStream();
      Manifest mf2 = new Manifest(mf2IS);
      Attributes mainAttrs2 = mf2.getMainAttributes();
      String title2 = mainAttrs2.getValue(Attributes.Name.SPECIFICATION_TITLE);
      assertEquals("jar2", title2);
      mf2IS.close();
View Full Code Here

   {
      URL url = getResource("/vfs/context/jar/complex.jar");
      VFSContext ctx = createVSFContext(url);

      VirtualFileHandler sub = ctx.getRoot().getChild("subfolder");
      InputStream is = sub.openStream();
      try
      {
         // JBVFS-57 JarInputStream composition - recomposes directory as a
         // jar equivalent to jar:complex.jar!/subfolder
         // NOT IMPLEMENTED for vfsjar - vfsjar is deprecated
View Full Code Here

      VFSContext ctx = createVSFContext(url);

      VirtualFileHandler nested = ctx.getRoot().getChild("complex.jar");
      VirtualFileHandler target = nested.getChild("META-INF/MANIFEST.MF");

      InputStream is = target.openStream();
      try
      {
         assertFalse("input stream closed", is.read() == -1);
      }
      finally
View Full Code Here

      assertNotNull("toURI not null", handler.toURI());
      assertNotNull("toURL not null", handler.toURL());
      assertNotNull("toVfsUrl not null", handler.toVfsUrl());

      ByteArrayOutputStream memOut = new ByteArrayOutputStream();
      VFSUtils.copyStreamAndClose(handler.openStream(), memOut);
      assertTrue("read archive content", memOut.size() == handler.getSize());

      // invalid archive

      handler = ctx.getRoot().getChild("notanarchive.jar");
View Full Code Here

      assertNotNull("toURI not null", handler.toURI());
      assertNotNull("toURL not null", handler.toURL());
      assertNotNull("toVfsUrl not null", handler.toVfsUrl());

      memOut = new ByteArrayOutputStream();
      VFSUtils.copyStreamAndClose(handler.openStream(), memOut);
      assertTrue("read archive content", memOut.size() == handler.getSize());
   }

   /**
    * Real URL test
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.