|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| JarEntry.java | - | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
/*
|
|
| 2 |
* EJTools, the Enterprise Java Tools
|
|
| 3 |
*
|
|
| 4 |
* Distributable under LGPL license.
|
|
| 5 |
* See terms of license at www.gnu.org.
|
|
| 6 |
*/
|
|
| 7 |
package org.ejtools.archive;
|
|
| 8 |
|
|
| 9 |
import org.ejtools.archive.io.Reader;
|
|
| 10 |
import org.ejtools.archive.io.Writer;
|
|
| 11 |
|
|
| 12 |
/**
|
|
| 13 |
* Implementation for a Jar based entry.
|
|
| 14 |
*
|
|
| 15 |
* @author Laurent Etiemble
|
|
| 16 |
* @version $Revision: 1.2 $
|
|
| 17 |
*/
|
|
| 18 |
public class JarEntry implements Entry |
|
| 19 |
{
|
|
| 20 |
/** The binary content */
|
|
| 21 |
private byte[] content; |
|
| 22 |
/** The absolute URI */
|
|
| 23 |
private String uri = ""; |
|
| 24 |
|
|
| 25 |
|
|
| 26 |
/**
|
|
| 27 |
* Constructor for the JarEntry object
|
|
| 28 |
*
|
|
| 29 |
* @param uri The URI of the entry
|
|
| 30 |
*/
|
|
| 31 | 0 |
public JarEntry(String uri)
|
| 32 |
{
|
|
| 33 | 0 |
this.uri = uri;
|
| 34 |
} |
|
| 35 |
|
|
| 36 |
|
|
| 37 |
/**
|
|
| 38 |
* Visitor Pattern method to accept a Writer visitor
|
|
| 39 |
*
|
|
| 40 |
* @param visitor The writer visitor
|
|
| 41 |
*/
|
|
| 42 | 0 |
public void accept(Writer visitor) |
| 43 |
{
|
|
| 44 | 0 |
visitor.visit(this);
|
| 45 |
} |
|
| 46 |
|
|
| 47 |
|
|
| 48 |
/**
|
|
| 49 |
* Visitor Pattern method to accept a Reader visitor
|
|
| 50 |
*
|
|
| 51 |
* @param visitor The reader visitor
|
|
| 52 |
*/
|
|
| 53 | 0 |
public void accept(Reader visitor) |
| 54 |
{
|
|
| 55 | 0 |
visitor.visit(this);
|
| 56 |
} |
|
| 57 |
|
|
| 58 |
|
|
| 59 |
/**
|
|
| 60 |
* Adds this entry to an archive
|
|
| 61 |
*
|
|
| 62 |
* @param archive The archive to be added to
|
|
| 63 |
*/
|
|
| 64 | 0 |
public void addTo(Archive archive) |
| 65 |
{
|
|
| 66 | 0 |
archive.addEntry(this);
|
| 67 |
} |
|
| 68 |
|
|
| 69 |
|
|
| 70 |
/**
|
|
| 71 |
* Returns the content of this entry
|
|
| 72 |
*
|
|
| 73 |
* @return The content
|
|
| 74 |
*/
|
|
| 75 | 0 |
public byte[] getContent() |
| 76 |
{
|
|
| 77 | 0 |
return this.content; |
| 78 |
} |
|
| 79 |
|
|
| 80 |
|
|
| 81 |
/**
|
|
| 82 |
* Return the absolute URI of this entry
|
|
| 83 |
*
|
|
| 84 |
* @return The URI
|
|
| 85 |
*/
|
|
| 86 | 0 |
public String getURI()
|
| 87 |
{
|
|
| 88 | 0 |
return this.uri; |
| 89 |
} |
|
| 90 |
|
|
| 91 |
|
|
| 92 |
/**
|
|
| 93 |
* Always returns false as it is not an archive
|
|
| 94 |
*
|
|
| 95 |
* @return Always false
|
|
| 96 |
*/
|
|
| 97 | 0 |
public boolean isArchive() |
| 98 |
{
|
|
| 99 | 0 |
return false; |
| 100 |
} |
|
| 101 |
|
|
| 102 |
|
|
| 103 |
/**
|
|
| 104 |
* Sets the content of this entry
|
|
| 105 |
*
|
|
| 106 |
* @param content The new content
|
|
| 107 |
*/
|
|
| 108 | 0 |
public void setContent(byte[] content) |
| 109 |
{
|
|
| 110 | 0 |
this.content = content;
|
| 111 |
} |
|
| 112 |
|
|
| 113 |
|
|
| 114 |
/**
|
|
| 115 |
* Sets the URI of this entry
|
|
| 116 |
*
|
|
| 117 |
* @param uri The new URI
|
|
| 118 |
*/
|
|
| 119 | 0 |
public void setURI(String uri) |
| 120 |
{
|
|
| 121 | 0 |
this.uri = uri;
|
| 122 |
} |
|
| 123 |
} |
|
| 124 |
|
|
||||||||||