@Override public byte[] asBytes() throws IOException { return delegate.asBytes(); }
/** Reads the full content of the file object and returns it as string. * @param encoding the encoding to use * @return string representing the content of the file * @exception IOException in case the content cannot be fully read * @since 7.21 */ public String asText(String encoding) throws IOException { return new String(asBytes(), encoding); }
private void initReader() throws UnsupportedEncodingException, IOException { InputStream is; if (lines.fo.getSize() < 64 * 1024) { if (buffer == null) { buffer = lines.fo.asBytes(); } is = new ByteArrayInputStream(buffer); } else { is = lines.fo.getInputStream(); } this.reader = new BufferedReader(new InputStreamReader(is, encoding)); this.index = 0; while (this.index < index) { next(); } }
@Override protected byte[] getClassFileBytes() throws IOException, ClassNotFoundException { return p.asBytes(); } };
@Override protected byte[] getClassFileBytes() throws IOException, ClassNotFoundException { return sibling.asBytes(); } };
cfp.parseClassFile(p.asBytes(), ci); rslt.add(new FileClassInfo(ci, root, p)); } catch (IOException ex) {
@Override public Set<SourceClassInfo> getInnerClases() { Set<SourceClassInfo> rslt = new HashSet<SourceClassInfo>(); ClassFileParser cfp = new ClassFileParser(); Enumeration<? extends FileObject> siblings = clazz.getParent().getData(false); while (siblings.hasMoreElements()) { final FileObject sibling = siblings.nextElement(); if (sibling.getName().contains("$") && sibling.getName().startsWith(clazz.getName()) && !sibling.getName().equals(clazz.getName())) { // NOI18N ClassInfo ci = new ClassInfo(sibling.getName(), 0) { @Override protected byte[] getClassFileBytes() throws IOException, ClassNotFoundException { return sibling.asBytes(); } }; try { cfp.parseClassFile(sibling.asBytes(), ci); rslt.add(new FileClassInfo(ci, root, sibling)); } catch (IOException ex) { } catch (ClassFileParser.ClassFileReadException ex) { } } } return rslt; }