当前位置: 技术问答>java相关
关于jar的问题
来源: 互联网 发布时间:2014-12-31
本文导语: 请问有谁知道对jar文件加密,加密后再在使用 时怎么打开? | java 好象没有提供jar的加密,但你可以自己做个先加密在压缩,然后先解压后解密。 =========================== java.util.jar Class Attrib...
请问有谁知道对jar文件加密,加密后再在使用
时怎么打开?
时怎么打开?
|
java 好象没有提供jar的加密,但你可以自己做个先加密在压缩,然后先解压后解密。
===========================
java.util.jar
Class Attributes
java.lang.Object
|
+--java.util.jar.Attributes
--------------------------------------------------------------------------------
public class Attributes
extends Object
implements Map, Cloneable
The Attributes class maps Manifest attribute names to associated string values. Attribute names are case-insensitive and restricted to the ASCII characters in the set [0-9a-zA-Z_-]. Attribute values can contain any characters and will be UTF8-encoded when written to the output stream.
Since:
JDK1.2
See Also:
Manifest
--------------------------------------------------------------------------------
Inner Class Summary
static class Attributes.Name
The Attributes.Name class represents an attribute name stored in this Map.
Field Summary
protected Map map
The attribute name-value mappings.
Constructor Summary
Attributes()
Constructs a new, empty Attributes object with default size.
Attributes(Attributes attr)
Constructs a new Attributes object with the same attribute name-value mappings as in the specified Attributes.
Attributes(int size)
Constructs a new, empty Attributes object with the specified initial size.
Method Summary
void clear()
Removes all attributes from this Map.
Object clone()
Returns a copy of the Attributes, implemented as follows: public Object clone() { return new Attributes(this); } Since the attribute names and values are themselves immutable, the Attributes returned can be safely modified without affecting the original.
boolean containsKey(Object name)
Returns true if this Map contains the specified attribute name (key).
boolean containsValue(Object value)
Returns true if this Map maps one or more attribute names (keys) to the specified value.
Set entrySet()
Returns a Collection view of the attribute name-value mappings contained in this Map.
boolean equals(Object o)
Compares the specified Attributes object with this Map for equality.
Object get(Object name)
Returns the value of the specified attribute name, or null if the attribute name was not found.
String getValue(Attributes.Name name)
Returns the value of the specified Attributes.Name, or null if the attribute was not found.
String getValue(String name)
Returns the value of the specified attribute name, specified as a string, or null if the attribute was not found.
int hashCode()
Returns the hash code value for this Map.
boolean isEmpty()
Returns true if this Map contains no attributes.
Set keySet()
Returns a Set view of the attribute names (keys) contained in this Map.
Object put(Object name, Object value)
Associates the specified value with the specified attribute name (key) in this Map.
void putAll(Map attr)
Copies all of the attribute name-value mappings from the specified Attributes to this Map.
String putValue(String name, String value)
Associates the specified value with the specified attribute name, specified as a String.
Object remove(Object name)
Removes the attribute with the specified name (key) from this Map.
int size()
Returns the number of attributes in this Map.
Collection values()
Returns a Collection view of the attribute values contained in this Map.
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Field Detail
map
protected Map map
The attribute name-value mappings.
Constructor Detail
Attributes
public Attributes()
Constructs a new, empty Attributes object with default size.
--------------------------------------------------------------------------------
Attributes
public Attributes(int size)
Constructs a new, empty Attributes object with the specified initial size.
Parameters:
size - the initial number of attributes
--------------------------------------------------------------------------------
Attributes
public Attributes(Attributes attr)
Constructs a new Attributes object with the same attribute name-value mappings as in the specified Attributes.
Method Detail
get
public Object get(Object name)
Returns the value of the specified attribute name, or null if the attribute name was not found.
Specified by:
get in interface Map
Parameters:
name - the attribute name
--------------------------------------------------------------------------------
getValue
public String getValue(String name)
Returns the value of the specified attribute name, specified as a string, or null if the attribute was not found. The attribute name is case-insensitive.
This method is defined as:
return (String)get(new Attributes.Name((String)name));
Parameters:
name - the attribute name as a string
--------------------------------------------------------------------------------
getValue
public String getValue(Attributes.Name name)
Returns the value of the specified Attributes.Name, or null if the attribute was not found.
This method is defined as:
return (String)get(name);
Parameters:
name - the Attributes.Name object
--------------------------------------------------------------------------------
put
public Object put(Object name,
Object value)
Associates the specified value with the specified attribute name (key) in this Map. If the Map previously contained a mapping for the attribute name, the old value is replaced.
Specified by:
put in interface Map
Parameters:
name - the attribute name
value - the attribute value
Returns:
the previous value of the attribute, or null if none
Throws:
ClassCastException - if the name is not a Attributes.Name or the value is not a String
--------------------------------------------------------------------------------
putValue
public String putValue(String name,
String value)
Associates the specified value with the specified attribute name, specified as a String. The attributes name is case-insensitive. If the Map previously contained a mapping for the attribute name, the old value is replaced.
This method is defined as:
return (String)put(new Attributes.Name(name), value);
Parameters:
the - attribute name as a string
value - the attribute value
Throws:
IllegalArgumentException - if the attribute name is invalid
--------------------------------------------------------------------------------
remove
public Object remove(Object name)
Removes the attribute with the specified name (key) from this Map. Returns the previous attribute value, or null if none.
Specified by:
remove in interface Map
Parameters:
name - attribute name
--------------------------------------------------------------------------------
containsValue
public boolean containsValue(Object value)
Returns true if this Map maps one or more attribute names (keys) to the specified value.
Specified by:
containsValue in interface Map
Parameters:
value - the attribute value
--------------------------------------------------------------------------------
containsKey
public boolean containsKey(Object name)
Returns true if this Map contains the specified attribute name (key).
Specified by:
containsKey in interface Map
Parameters:
name - the attribute name
--------------------------------------------------------------------------------
putAll
public void putAll(Map attr)
Copies all of the attribute name-value mappings from the specified Attributes to this Map. Duplicate mappings will be replaced.
Specified by:
putAll in interface Map
Parameters:
attr - the Attributes to be stored in this map
--------------------------------------------------------------------------------
clear
public void clear()
Removes all attributes from this Map.
Specified by:
clear in interface Map
--------------------------------------------------------------------------------
size
public int size()
Returns the number of attributes in this Map.
Specified by:
size in interface Map
--------------------------------------------------------------------------------
isEmpty
public boolean isEmpty()
Returns true if this Map contains no attributes.
Specified by:
isEmpty in interface Map
--------------------------------------------------------------------------------
keySet
public Set keySet()
Returns a Set view of the attribute names (keys) contained in this Map.
Specified by:
keySet in interface Map
--------------------------------------------------------------------------------
values
public Collection values()
Returns a Collection view of the attribute values contained in this Map.
Specified by:
values in interface Map
--------------------------------------------------------------------------------
entrySet
public Set entrySet()
Returns a Collection view of the attribute name-value mappings contained in this Map.
Specified by:
entrySet in interface Map
--------------------------------------------------------------------------------
equals
public boolean equals(Object o)
Compares the specified Attributes object with this Map for equality. Returns true if the given object is also an instance of Attributes and the two Attributes objects represent the same mappings.
Specified by:
equals in interface Map
Parameters:
o - the Object to be compared
Returns:
true if the specified Object is equal to this Map
Overrides:
equals in class Object
--------------------------------------------------------------------------------
hashCode
public int hashCode()
Returns the hash code value for this Map.
Specified by:
hashCode in interface Map
Overrides:
hashCode in class Object
--------------------------------------------------------------------------------
clone
public Object clone()
Returns a copy of the Attributes, implemented as follows:
public Object clone() { return new Attributes(this); }
Since the attribute names and values are themselves immutable, the Attributes returned can be safely modified without affecting the original.
Overrides:
clone in class Object
===========================
java.util.jar
Class Attributes
java.lang.Object
|
+--java.util.jar.Attributes
--------------------------------------------------------------------------------
public class Attributes
extends Object
implements Map, Cloneable
The Attributes class maps Manifest attribute names to associated string values. Attribute names are case-insensitive and restricted to the ASCII characters in the set [0-9a-zA-Z_-]. Attribute values can contain any characters and will be UTF8-encoded when written to the output stream.
Since:
JDK1.2
See Also:
Manifest
--------------------------------------------------------------------------------
Inner Class Summary
static class Attributes.Name
The Attributes.Name class represents an attribute name stored in this Map.
Field Summary
protected Map map
The attribute name-value mappings.
Constructor Summary
Attributes()
Constructs a new, empty Attributes object with default size.
Attributes(Attributes attr)
Constructs a new Attributes object with the same attribute name-value mappings as in the specified Attributes.
Attributes(int size)
Constructs a new, empty Attributes object with the specified initial size.
Method Summary
void clear()
Removes all attributes from this Map.
Object clone()
Returns a copy of the Attributes, implemented as follows: public Object clone() { return new Attributes(this); } Since the attribute names and values are themselves immutable, the Attributes returned can be safely modified without affecting the original.
boolean containsKey(Object name)
Returns true if this Map contains the specified attribute name (key).
boolean containsValue(Object value)
Returns true if this Map maps one or more attribute names (keys) to the specified value.
Set entrySet()
Returns a Collection view of the attribute name-value mappings contained in this Map.
boolean equals(Object o)
Compares the specified Attributes object with this Map for equality.
Object get(Object name)
Returns the value of the specified attribute name, or null if the attribute name was not found.
String getValue(Attributes.Name name)
Returns the value of the specified Attributes.Name, or null if the attribute was not found.
String getValue(String name)
Returns the value of the specified attribute name, specified as a string, or null if the attribute was not found.
int hashCode()
Returns the hash code value for this Map.
boolean isEmpty()
Returns true if this Map contains no attributes.
Set keySet()
Returns a Set view of the attribute names (keys) contained in this Map.
Object put(Object name, Object value)
Associates the specified value with the specified attribute name (key) in this Map.
void putAll(Map attr)
Copies all of the attribute name-value mappings from the specified Attributes to this Map.
String putValue(String name, String value)
Associates the specified value with the specified attribute name, specified as a String.
Object remove(Object name)
Removes the attribute with the specified name (key) from this Map.
int size()
Returns the number of attributes in this Map.
Collection values()
Returns a Collection view of the attribute values contained in this Map.
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Field Detail
map
protected Map map
The attribute name-value mappings.
Constructor Detail
Attributes
public Attributes()
Constructs a new, empty Attributes object with default size.
--------------------------------------------------------------------------------
Attributes
public Attributes(int size)
Constructs a new, empty Attributes object with the specified initial size.
Parameters:
size - the initial number of attributes
--------------------------------------------------------------------------------
Attributes
public Attributes(Attributes attr)
Constructs a new Attributes object with the same attribute name-value mappings as in the specified Attributes.
Method Detail
get
public Object get(Object name)
Returns the value of the specified attribute name, or null if the attribute name was not found.
Specified by:
get in interface Map
Parameters:
name - the attribute name
--------------------------------------------------------------------------------
getValue
public String getValue(String name)
Returns the value of the specified attribute name, specified as a string, or null if the attribute was not found. The attribute name is case-insensitive.
This method is defined as:
return (String)get(new Attributes.Name((String)name));
Parameters:
name - the attribute name as a string
--------------------------------------------------------------------------------
getValue
public String getValue(Attributes.Name name)
Returns the value of the specified Attributes.Name, or null if the attribute was not found.
This method is defined as:
return (String)get(name);
Parameters:
name - the Attributes.Name object
--------------------------------------------------------------------------------
put
public Object put(Object name,
Object value)
Associates the specified value with the specified attribute name (key) in this Map. If the Map previously contained a mapping for the attribute name, the old value is replaced.
Specified by:
put in interface Map
Parameters:
name - the attribute name
value - the attribute value
Returns:
the previous value of the attribute, or null if none
Throws:
ClassCastException - if the name is not a Attributes.Name or the value is not a String
--------------------------------------------------------------------------------
putValue
public String putValue(String name,
String value)
Associates the specified value with the specified attribute name, specified as a String. The attributes name is case-insensitive. If the Map previously contained a mapping for the attribute name, the old value is replaced.
This method is defined as:
return (String)put(new Attributes.Name(name), value);
Parameters:
the - attribute name as a string
value - the attribute value
Throws:
IllegalArgumentException - if the attribute name is invalid
--------------------------------------------------------------------------------
remove
public Object remove(Object name)
Removes the attribute with the specified name (key) from this Map. Returns the previous attribute value, or null if none.
Specified by:
remove in interface Map
Parameters:
name - attribute name
--------------------------------------------------------------------------------
containsValue
public boolean containsValue(Object value)
Returns true if this Map maps one or more attribute names (keys) to the specified value.
Specified by:
containsValue in interface Map
Parameters:
value - the attribute value
--------------------------------------------------------------------------------
containsKey
public boolean containsKey(Object name)
Returns true if this Map contains the specified attribute name (key).
Specified by:
containsKey in interface Map
Parameters:
name - the attribute name
--------------------------------------------------------------------------------
putAll
public void putAll(Map attr)
Copies all of the attribute name-value mappings from the specified Attributes to this Map. Duplicate mappings will be replaced.
Specified by:
putAll in interface Map
Parameters:
attr - the Attributes to be stored in this map
--------------------------------------------------------------------------------
clear
public void clear()
Removes all attributes from this Map.
Specified by:
clear in interface Map
--------------------------------------------------------------------------------
size
public int size()
Returns the number of attributes in this Map.
Specified by:
size in interface Map
--------------------------------------------------------------------------------
isEmpty
public boolean isEmpty()
Returns true if this Map contains no attributes.
Specified by:
isEmpty in interface Map
--------------------------------------------------------------------------------
keySet
public Set keySet()
Returns a Set view of the attribute names (keys) contained in this Map.
Specified by:
keySet in interface Map
--------------------------------------------------------------------------------
values
public Collection values()
Returns a Collection view of the attribute values contained in this Map.
Specified by:
values in interface Map
--------------------------------------------------------------------------------
entrySet
public Set entrySet()
Returns a Collection view of the attribute name-value mappings contained in this Map.
Specified by:
entrySet in interface Map
--------------------------------------------------------------------------------
equals
public boolean equals(Object o)
Compares the specified Attributes object with this Map for equality. Returns true if the given object is also an instance of Attributes and the two Attributes objects represent the same mappings.
Specified by:
equals in interface Map
Parameters:
o - the Object to be compared
Returns:
true if the specified Object is equal to this Map
Overrides:
equals in class Object
--------------------------------------------------------------------------------
hashCode
public int hashCode()
Returns the hash code value for this Map.
Specified by:
hashCode in interface Map
Overrides:
hashCode in class Object
--------------------------------------------------------------------------------
clone
public Object clone()
Returns a copy of the Attributes, implemented as follows:
public Object clone() { return new Attributes(this); }
Since the attribute names and values are themselves immutable, the Attributes returned can be safely modified without affecting the original.
Overrides:
clone in class Object