Package org.jboss.virtual

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


    }
    VirtualFile file =this.files.get(path);
    if (file == null) {
      throw new IOException(RuntimePlugin.Util.getString("udf_model_not_found", name)); //$NON-NLS-1$
    }
    List<FunctionMethod> udfMethods = FunctionMetadataReader.loadFunctionMethods(file.openStream());
    ActivityReport<ReportItem> report = new ActivityReport<ReportItem>("UDF load"); //$NON-NLS-1$
    FunctionMetadataValidator.validateFunctionMethods(udfMethods,report);
    if(report.hasItems()) {
        throw new QueryMetadataException(QueryPlugin.Util.getString("ERR.015.001.0005", report)); //$NON-NLS-1$
    }
View Full Code Here


      final VirtualFile f = getFile(resourcePath);
      if (f == null) {
        return null;
      }
    try {
      return ObjectConverterUtil.convertToByteArray(f.openStream());
    } catch (IOException e) {
      throw new TeiidComponentException(e);
    }
    }
   
View Full Code Here

      byte[] bytes = new byte[] { 1, 2, 3, 4, 5 };
      MockVFSContext context = registerSimpleVFSContext();
      context.getMockRoot().setStream(bytes);

      VirtualFile file = VFS.getRoot(context.getRootURI());
      InputStream stream = file.openStream();
      byte[] buffer = new byte[bytes.length];
      stream.read(buffer);
     
      assertTrue(stream.read() == -1);
      assertTrue(Arrays.equals(bytes, buffer));
View Full Code Here

      context.getMockRoot().setIOException("openStream");

      VirtualFile file = VFS.getRoot(context.getRootURI());
      try
      {
         file.openStream();
         fail("Should not be here");
      }
      catch (Throwable t)
      {
         checkThrowable(IOException.class, t);
View Full Code Here

      VirtualFile file = VFS.getRoot(context.getRootURI());
      file.close();
      try
      {
         file.openStream();
         fail("Should not be here");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalStateException.class, t);
View Full Code Here

      byte[] bytes = new byte[] { 1, 2, 3, 4, 5 };
      MockVFSContext context = registerSimpleVFSContext();
      context.getMockRoot().setStream(bytes);

      VirtualFile file = VFS.getRoot(context.getRootURI());
      InputStream stream = file.openStream();
      assertEquals(1, stream.read());
     
      file.closeStreams();
      assertEquals(-1, stream.read());
   }
View Full Code Here

      byte[] bytes = new byte[] { 1, 2, 3, 4, 5 };
      MockVFSContext context = registerSimpleVFSContext();
      context.getMockRoot().setStream(bytes);

      VirtualFile file = VFS.getRoot(context.getRootURI());
      InputStream stream = file.openStream();
      assertEquals(1, stream.read());
     
      file.close();
      assertEquals(-1, stream.read());
   }
View Full Code Here

      {
         log.info("  "+vf.getName());
      }
      VirtualFile vf = vfs.findChild("outer.jar/jar1.jar");
      VirtualFile jar1MF = vf.findChild("META-INF/MANIFEST.MF");
      InputStream mfIS = jar1MF.openStream();
      Manifest mf = new Manifest(mfIS);
      Attributes mainAttrs = mf.getMainAttributes();
      String version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_TITLE);
      assertEquals(Attributes.Name.SPECIFICATION_TITLE.toString(), "jar1", version);
      mfIS.close();
View Full Code Here

      VirtualFile jar = vfs.findChild("jar1-filesonly.jar");
      VirtualFile metadataLocation = jar.findChild("META-INF");
      assertNotNull(metadataLocation);
      VirtualFile mfFile = metadataLocation.findChild("MANIFEST.MF");
      assertNotNull(mfFile);
      InputStream is = mfFile.openStream();
      Manifest mf = new Manifest(is);
      mfFile.close();
      String title = mf.getMainAttributes().getValue(Attributes.Name.SPECIFICATION_TITLE);
      assertEquals(Attributes.Name.SPECIFICATION_TITLE.toString(), "jar1-filesonly", title);
View Full Code Here

      String title = mf.getMainAttributes().getValue(Attributes.Name.SPECIFICATION_TITLE);
      assertEquals(Attributes.Name.SPECIFICATION_TITLE.toString(), "jar1-filesonly", title);

      // Retry starting from the jar root
      mfFile = jar.findChild("META-INF/MANIFEST.MF");
      is = mfFile.openStream();
      mf = new Manifest(is);
      mfFile.close();
      title = mf.getMainAttributes().getValue(Attributes.Name.SPECIFICATION_TITLE);
      assertEquals(Attributes.Name.SPECIFICATION_TITLE.toString(), "jar1-filesonly", title);
   }
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.