All Downloads are FREE. Search and download functionalities are using the official Maven repository.

aQute.launcher.minifw.Headers Maven / Gradle / Ivy

There is a newer version: 7.0.0
Show newest version
package aQute.launcher.minifw;

import static aQute.launcher.minifw.Enumerations.enumeration;

import java.util.Collection;
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.jar.Manifest;
import java.util.stream.Stream;

class Headers extends Dictionary {
	private final Manifest manifest;

	Headers(Manifest manifest) {
		this.manifest = manifest;
	}

	@Override
	public Enumeration elements() {
		@SuppressWarnings({
			"unchecked", "rawtypes"
		})
		Collection elements = (Collection) manifest.getMainAttributes()
			.values();
		return enumeration(elements);
	}

	@Override
	public String get(Object key) {
		String o = manifest.getMainAttributes()
			.getValue((String) key);
		return o;
	}

	@Override
	public boolean isEmpty() {
		return manifest.getMainAttributes()
			.isEmpty();
	}

	@Override
	public Enumeration keys() {
		Stream keys = manifest.getMainAttributes()
			.keySet()
			.stream()
			.map(Object::toString);
		return enumeration(keys);
	}

	@Override
	public String put(String key, String value) {
		throw new UnsupportedOperationException();
	}

	@Override
	public String remove(Object key) {
		throw new UnsupportedOperationException();
	}

	@Override
	public int size() {
		return manifest.getMainAttributes()
			.size();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy