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, 2016 itemis AG (http://www.itemis.eu) and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
*******************************************************************************/
package org.eclipse.xtext.util;
import static com.google.common.collect.Sets.*;
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.Objects;
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
* @deprecated Uses reflection which will not work well with future java
* versions. Use {@link MergeableManifest2} instead.
*/
@Deprecated(forRemoval=true)
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");
/**
* @deprecated Is only used in deprecated static methods.
*/
@Deprecated
private static final String LINEBREAK = Strings.newLine();
/*
* java.util.Manifest throws an exception if line exceeds 512 chars
*/
/**
* @deprecated Use {@link #make512Safe(StringBuffer, String)} instead
* @since 2.9
*/
@Deprecated
public static String make512Safe(StringBuffer lines) {
return make512Safe(lines, LINEBREAK);
}
/**
* @since 2.11
*/
public static String make512Safe(StringBuffer lines, String lineDelimiter) {
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, lineDelimiter + " ");
idx += 512;
length += 3;
}
result.append(temp.toString());
} else {
result.append(string);
}
result.append(lineDelimiter);
}
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