Lines 298-303
Link Here
|
298 |
} |
298 |
} |
299 |
} |
299 |
} |
300 |
} |
300 |
} |
|
|
301 |
|
302 |
public byte[] getBytes() throws JavaModelException { |
303 |
JavaElement pkg = (JavaElement) getParent(); |
304 |
if (pkg instanceof JarPackageFragment) { |
305 |
JarPackageFragmentRoot root = (JarPackageFragmentRoot) pkg.getParent(); |
306 |
ZipFile zip = null; |
307 |
try { |
308 |
zip = root.getJar(); |
309 |
String entryName = Util.concatWith(((PackageFragment) pkg).names, getElementName(), '/'); |
310 |
ZipEntry ze = zip.getEntry(entryName); |
311 |
if (ze != null) { |
312 |
return org.eclipse.jdt.internal.compiler.util.Util.getZipEntryByteContent(ze, zip); |
313 |
} |
314 |
throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST, this)); |
315 |
} catch (IOException ioe) { |
316 |
throw new JavaModelException(ioe, IJavaModelStatusConstants.IO_EXCEPTION); |
317 |
} catch (CoreException e) { |
318 |
if (e instanceof JavaModelException) { |
319 |
throw (JavaModelException)e; |
320 |
} else { |
321 |
throw new JavaModelException(e); |
322 |
} |
323 |
} finally { |
324 |
JavaModelManager.getJavaModelManager().closeZipFile(zip); |
325 |
} |
326 |
} else { |
327 |
IFile file = (IFile) getResource(); |
328 |
return Util.getResourceContentsAsByteArray(file); |
329 |
} |
330 |
} |
301 |
private IBinaryType getJarBinaryTypeInfo(PackageFragment pkg) throws CoreException, IOException, ClassFormatException { |
331 |
private IBinaryType getJarBinaryTypeInfo(PackageFragment pkg) throws CoreException, IOException, ClassFormatException { |
302 |
JarPackageFragmentRoot root = (JarPackageFragmentRoot) pkg.getParent(); |
332 |
JarPackageFragmentRoot root = (JarPackageFragmentRoot) pkg.getParent(); |
303 |
ZipFile zip = null; |
333 |
ZipFile zip = null; |