public boolean hasEntry(String name) { if (excludes.contains(name)) { return false; } return directory.hasEntry(name); }
/** * Add the \1OLE marker entry, which is not the Ole10Native entry. * Beside this "\u0001Ole" record there were several other records, e.g. CompObj, * OlePresXXX, but it seems, that they aren't necessary */ public static void createOleMarkerEntry(final DirectoryEntry parent) throws IOException { if (!parent.hasEntry(OLE_MARKER_NAME)) { parent.createDocument(OLE_MARKER_NAME, new ByteArrayInputStream(OLE_MARKER_BYTES)); } }
public int getEntryCount() { int size = directory.getEntryCount(); for (String excl : excludes) { if (directory.hasEntry(excl)) { size--; } } return size; }
/** * Writes a property set to a document in a POI filesystem directory. * * @param dir The directory in the POI filesystem to write the document to. * @param name The document's name. If there is already a document with the * same name in the directory the latter will be overwritten. * * @throws WritingNotSupportedException if the filesystem doesn't support writing * @throws IOException if the old entry can't be deleted or the new entry be written */ public void write(final DirectoryEntry dir, final String name) throws WritingNotSupportedException, IOException { /* If there is already an entry with the same name, remove it. */ if (dir.hasEntry(name)) { final Entry e = dir.getEntry(name); e.delete(); } /* Create the new entry. */ dir.createDocument(name, toInputStream()); }
public static DocumentEntry createEncryptionEntry(DirectoryEntry dir, String path, EncryptionRecord out) throws IOException { String parts[] = path.split("/"); for (int i=0; i<parts.length-1; i++) { dir = dir.hasEntry(parts[i]) ? (DirectoryEntry)dir.getEntry(parts[i]) : dir.createDirectory(parts[i]); } final byte buf[] = new byte[5000]; LittleEndianByteArrayOutputStream bos = new LittleEndianByteArrayOutputStream(buf, 0); out.write(bos); String fileName = parts[parts.length-1]; if (dir.hasEntry(fileName)) { dir.getEntry(fileName).delete(); } return dir.createDocument(fileName, bos.getWriteIndex(), new POIFSWriterListener(){ public void processPOIFSWriterEvent(POIFSWriterEvent event) { try { event.getStream().write(buf, 0, event.getLimit()); } catch (IOException e) { throw new EncryptedDocumentException(e); } } }); }
public boolean hasEntry(String name) { if (excludes.contains(name)) { return false; } return directory.hasEntry(name); }
public boolean hasEntry(String name) { if (excludes.contains(name)) { return false; } return directory.hasEntry(name); }
public boolean hasEntry(String name) { if (excludes.contains(name)) { return false; } return directory.hasEntry(name); }
/** * Add the \1OLE marker entry, which is not the Ole10Native entry. * Beside this "\u0001Ole" record there were several other records, e.g. CompObj, * OlePresXXX, but it seems, that they aren't necessary */ public static void createOleMarkerEntry(final DirectoryEntry parent) throws IOException { if (!parent.hasEntry(OLE_MARKER_NAME)) { parent.createDocument(OLE_MARKER_NAME, new ByteArrayInputStream(OLE_MARKER_BYTES)); } }
public int getEntryCount() { int size = directory.getEntryCount(); for (String excl : excludes) { if (directory.hasEntry(excl)) { size--; } } return size; }
public int getEntryCount() { int size = directory.getEntryCount(); for (String excl : excludes) { if (directory.hasEntry(excl)) { size--; } } return size; }
public int getEntryCount() { int size = directory.getEntryCount(); for (String excl : excludes) { if (directory.hasEntry(excl)) { size--; } } return size; }
/** * Writes a property set to a document in a POI filesystem directory. * * @param dir The directory in the POI filesystem to write the document to. * @param name The document's name. If there is already a document with the * same name in the directory the latter will be overwritten. * * @throws WritingNotSupportedException if the filesystem doesn't support writing * @throws IOException if the old entry can't be deleted or the new entry be written */ public void write(final DirectoryEntry dir, final String name) throws WritingNotSupportedException, IOException { /* If there is already an entry with the same name, remove it. */ if (dir.hasEntry(name)) { final Entry e = dir.getEntry(name); e.delete(); } /* Create the new entry. */ dir.createDocument(name, toInputStream()); }
public static DocumentEntry createEncryptionEntry(DirectoryEntry dir, String path, EncryptionRecord out) throws IOException { String parts[] = path.split("/"); for (int i=0; i<parts.length-1; i++) { dir = dir.hasEntry(parts[i]) ? (DirectoryEntry)dir.getEntry(parts[i]) : dir.createDirectory(parts[i]); } final byte buf[] = new byte[5000]; LittleEndianByteArrayOutputStream bos = new LittleEndianByteArrayOutputStream(buf, 0); out.write(bos); String fileName = parts[parts.length-1]; if (dir.hasEntry(fileName)) { dir.getEntry(fileName).delete(); } return dir.createDocument(fileName, bos.getWriteIndex(), new POIFSWriterListener(){ public void processPOIFSWriterEvent(POIFSWriterEvent event) { try { event.getStream().write(buf, 0, event.getLimit()); } catch (IOException e) { throw new EncryptedDocumentException(e); } } }); }
if (dir.hasEntry("Package")) {
if (!dir.hasEntry(OLESTREAM_NAME)) {
if (dir.hasEntry("Package")) {
if (dir.hasEntry("Package")) {