Package org.eclipse.php.internal.core.tar

Examples of org.eclipse.php.internal.core.tar.TarEntry


   *            The path representing the container
   * @return The element represented by this pathname (it may have already
   *         existed)
   */
  protected TarEntry createContainer(IPath pathname) {
    TarEntry existingEntry = (TarEntry) directoryEntryCache.get(pathname);
    if (existingEntry != null) {
      return existingEntry;
    }

    TarEntry parent;
    if (pathname.segmentCount() == 1) {
      parent = root;
    } else {
      parent = createContainer(pathname.removeLastSegments(1));
    }
    TarEntry newEntry = new TarEntry(pathname.toString());
    newEntry.setFileType(TarEntry.DIRECTORY);
    directoryEntryCache.put(pathname, newEntry);
    List childList = new ArrayList();
    children.put(newEntry, childList);

    List parentChildList = (List) children.get(parent);
View Full Code Here


  /**
   * Creates a new tar file entry with the specified name.
   */
  protected void createFile(TarEntry entry) {
    IPath pathname = new Path(entry.getName());
    TarEntry parent;
    if (pathname.segmentCount() == 1) {
      parent = root;
    } else {
      parent = (TarEntry) directoryEntryCache.get(pathname
          .removeLastSegments(1));
View Full Code Here

   * @param element
   * @return the attributes of the file
   */
  public ResourceAttributes getResourceAttributes(Object element) {
    ResourceAttributes attributes = new ResourceAttributes();
    TarEntry entry = (TarEntry) element;
    attributes.setExecutable((entry.getMode() & 0100) != 0);
    attributes.setReadOnly((entry.getMode() & 0200) == 0);
    return attributes;
  }
View Full Code Here

    children = new HashMap(1000);

    children.put(root, new ArrayList());
    Enumeration entries = tarFile.entries();
    while (entries.hasMoreElements()) {
      TarEntry entry = (TarEntry) entries.nextElement();
      IPath path = new Path(entry.getName()).addTrailingSeparator();

      if (entry.getFileType() == TarEntry.DIRECTORY) {
        createContainer(path);
      } else {
        // Ensure the container structure for all levels above this is
        // initialized
        // Once we hit a higher-level container that's already added we
View Full Code Here

   * @exception org.eclipse.core.runtime.CoreException
   */
  public void write(IFile resource, String destinationPath)
      throws IOException, CoreException {

    TarEntry newEntry = new TarEntry(destinationPath);
    if (resource.getLocalTimeStamp() != IResource.NULL_STAMP) {
      newEntry.setTime(resource.getLocalTimeStamp() / 1000);
    }
    ResourceAttributes attributes = resource.getResourceAttributes();
    if (attributes != null && attributes.isExecutable()) {
      newEntry.setMode(newEntry.getMode() | 0111);
    }
    if (attributes != null && attributes.isReadOnly()) {
      newEntry.setMode(newEntry.getMode() & ~0222);
    }

    final URI location = resource.getLocationURI();
    if (location == null) {
      throw new FileNotFoundException(resource.getFullPath().toOSString());
    }

    newEntry.setSize(EFS.getStore(location).fetchInfo().getLength());

    write(newEntry, resource.getContents(false));
  }
View Full Code Here

    write(newEntry, resource.getContents(false));
  }

  public void writeStub(IStub stub) throws IOException, CoreException {
    ByteArrayInputStream stubInput = PharUtil.getStubInputStream(stub);
    TarEntry newEntry = new TarEntry(PharConstants.STUB_PATH);
    newEntry.setSize(stubInput.available());
    write(newEntry, stubInput);
  }
View Full Code Here

    outputStream.closeEntry();
  }

  public void write(IFolder resource, String destinationPath)
      throws IOException, CoreException {
    TarEntry newEntry = new TarEntry(destinationPath);
    if (resource.getLocalTimeStamp() != IResource.NULL_STAMP) {
      newEntry.setTime(resource.getLocalTimeStamp() / 1000);
    }
    ResourceAttributes attributes = resource.getResourceAttributes();
    if (attributes != null && attributes.isExecutable()) {
      newEntry.setMode(newEntry.getMode() | 0111);
    }
    if (attributes != null && attributes.isReadOnly()) {
      newEntry.setMode(newEntry.getMode() & ~0222);
    }

    final URI location = resource.getLocationURI();
    if (location == null) {
      throw new FileNotFoundException(resource.getFullPath().toOSString());
View Full Code Here

  public void doWriteSignature() throws IOException {
    byte[] signature = fileContentStream.getSignature();

    if (signature != null) {
      signature = PharUtil.getWholeSignature(signature, pharPackage);
      TarEntry newEntry = new TarEntry(PharConstants.SIGNATURE_PATH);
      newEntry.setSize(signature.length);
      write(newEntry, PharUtil.getInputStream(signature));
    }

  }
View Full Code Here

TOP

Related Classes of org.eclipse.php.internal.core.tar.TarEntry

Copyright © 2018 www.massapicom. 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.