Пример #1
0
 /** {@inheritDoc} */
 public ClassSpec getClassSpec(final String name) throws IOException {
   final VirtualFile file = root.getChild(name);
   if (!file.exists()) {
     return null;
   }
   final long size = file.getSize();
   final ClassSpec spec = new ClassSpec();
   final InputStream is = file.openStream();
   try {
     if (size <= (long) Integer.MAX_VALUE) {
       final int castSize = (int) size;
       byte[] bytes = new byte[castSize];
       int a = 0, res;
       while ((res = is.read(bytes, a, castSize - a)) > 0) {
         a += res;
       }
       // done
       is.close();
       spec.setBytes(bytes);
       spec.setCodeSource(new CodeSource(rootUrl, file.getCodeSigners()));
       return spec;
     } else {
       throw ServerMessages.MESSAGES.resourceTooLarge();
     }
   } finally {
     VFSUtils.safeClose(is);
   }
 }
Пример #2
0
 /** {@inheritDoc} */
 public CodeSigner[] getCodeSigners(VirtualFile mountPoint, VirtualFile target) {
   final VirtualFile assemblyFile = assembly.getFile(mountPoint, target);
   if (assemblyFile == null) {
     return null;
   }
   return assemblyFile.getCodeSigners();
 }