diff options
Diffstat (limited to 'plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/resource/ZipBinaryResource.java')
-rw-r--r-- | plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/resource/ZipBinaryResource.java | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/resource/ZipBinaryResource.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/resource/ZipBinaryResource.java index d5addb6200b..1ced5a1cfb0 100644 --- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/resource/ZipBinaryResource.java +++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/resource/ZipBinaryResource.java @@ -1,76 +1,76 @@ -/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.branch.management.exchange.resource;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.resource.management.IResource;
-import org.eclipse.osee.framework.resource.management.IResourceLocator;
-
-/**
- * @author Roberto E. Escobar
- */
-public final class ZipBinaryResource implements IResource {
-
- private final IResourceLocator locator;
- private final File entry;
-
- public ZipBinaryResource(File entry, IResourceLocator locator) {
- checkNotNull("FileEntry", entry);
- checkNotNull("IResourceLocator", locator);
- this.entry = entry;
- this.locator = locator;
- }
-
- private void checkNotNull(String argName, Object object) {
- if (object == null) {
- throw new IllegalArgumentException(String.format("Argument was null - [%s]", argName));
- }
- }
-
- @Override
- public InputStream getContent() throws OseeCoreException {
- InputStream inputStream = null;
- try {
- inputStream = new BufferedInputStream(new FileInputStream(entry));
- } catch (IOException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- return inputStream;
- }
-
- @Override
- public URI getLocation() {
- return locator.getLocation();
- }
-
- @Override
- public String getName() {
- String path = locator.getLocation().toASCIIString();
- int index = path.lastIndexOf("/");
- if (index != -1 && index + 1 < path.length()) {
- path = path.substring(index + 1, path.length());
- }
- return path;
- }
-
- @Override
- public boolean isCompressed() {
- return Lib.getExtension(entry.toString()).equals("zip");
- }
-}
+/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.framework.branch.management.exchange.resource; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.exception.OseeExceptions; +import org.eclipse.osee.framework.jdk.core.util.Lib; +import org.eclipse.osee.framework.resource.management.IResource; +import org.eclipse.osee.framework.resource.management.IResourceLocator; + +/** + * @author Roberto E. Escobar + */ +public final class ZipBinaryResource implements IResource { + + private final IResourceLocator locator; + private final File entry; + + public ZipBinaryResource(File entry, IResourceLocator locator) { + checkNotNull("FileEntry", entry); + checkNotNull("IResourceLocator", locator); + this.entry = entry; + this.locator = locator; + } + + private void checkNotNull(String argName, Object object) { + if (object == null) { + throw new IllegalArgumentException(String.format("Argument was null - [%s]", argName)); + } + } + + @Override + public InputStream getContent() throws OseeCoreException { + InputStream inputStream = null; + try { + inputStream = new BufferedInputStream(new FileInputStream(entry)); + } catch (IOException ex) { + OseeExceptions.wrapAndThrow(ex); + } + return inputStream; + } + + @Override + public URI getLocation() { + return locator.getLocation(); + } + + @Override + public String getName() { + String path = locator.getLocation().toASCIIString(); + int index = path.lastIndexOf("/"); + if (index != -1 && index + 1 < path.length()) { + path = path.substring(index + 1, path.length()); + } + return path; + } + + @Override + public boolean isCompressed() { + return Lib.getExtension(entry.toString()).equals("zip"); + } +} |