Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*******************************************************************************
* Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others.
* 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
*
*******************************************************************************/
package org.eclipse.xtext.util;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
import com.google.common.collect.Lists;
/**
* @author Sven Efftinge - Initial contribution and API
* @author Jan Koehnlein - merging of parameterized entries
* @since 2.2 moved to org.eclipse.xtext.util
*/
public class MergeableManifest extends Manifest {
public static final Attributes.Name BUNDLE_NAME = new Attributes.Name("Bundle-Name");
public static final Attributes.Name BUNDLE_SYMBOLIC_NAME = new Attributes.Name("Bundle-SymbolicName");
public static final Attributes.Name BUNDLE_VERSION = new Attributes.Name("Bundle-Version");
public static final Attributes.Name BUNDLE_CLASSPATH = new Attributes.Name("Bundle-ClassPath");
public static final Attributes.Name BUNDLE_VENDOR = new Attributes.Name("Bundle-Vendor");
public static final Attributes.Name BUNDLE_REQUIRED_EXECUTION_ENV = new Attributes.Name(
"Bundle-RequiredExecutionEnvironment");
public static final Attributes.Name EXPORT_PACKAGE = new Attributes.Name("Export-Package");
public static final Attributes.Name IMPORT_PACKAGE = new Attributes.Name("Import-Package");
public static final Attributes.Name REQUIRE_BUNDLE = new Attributes.Name("Require-Bundle");
public static final Attributes.Name BUNDLE_ACTIVATION_POLICY = new Attributes.Name("Bundle-ActivationPolicy");
public static final Attributes.Name BUNDLE_LOCALIZATION = new Attributes.Name("Bundle-Localization");
public static final Attributes.Name BUNDLE_ACTIVATOR = new Attributes.Name("Bundle-Activator");
private static final String LINEBREAK = "\r\n";
/*
* java.util.Manifest throws an exception if line exceeds 512 chars
*/
static String make512Safe(StringBuffer lines) {
if (lines.length() > 512) {
StringBuilder result = new StringBuilder(lines.length());
String[] splitted = lines.toString().split("\\r\\n");
for(String string: splitted) {
if (string.length() > 512) {
int idx = 510;
StringBuilder temp = new StringBuilder(string);
int length = temp.length();
while (idx < length - 2) {
temp.insert(idx, "\r\n ");
idx += 512;
length += 3;
}
result.append(temp.toString());
} else {
result.append(string);
}
result.append(LINEBREAK);
}
return result.toString();
}
return lines.toString();
}
public class OrderAwareAttributes extends Attributes {
public OrderAwareAttributes() {
try {
Field field = Attributes.class.getDeclaredField("map");
field.setAccessible(true);
field.set(this, new LinkedHashMap