ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/AntTasks/source/net/douglasthrift/anttasks/UnixZip.java
Revision: 1107
Committed: 2008-11-04T12:53:49-08:00 (16 years, 7 months ago) by douglas
File size: 1645 byte(s)
Log Message:
Stub out some Ant tasks for Android!

File Contents

# User Rev Content
1 douglas 1107 // Unix Zip Ant Task
2     //
3     // Douglas Thrift
4     //
5     // $Id$
6    
7     /* Copyright 2007 Douglas Thrift
8     *
9     * Licensed under the Apache License, Version 2.0 (the "License");
10     * you may not use this file except in compliance with the License.
11     * You may obtain a copy of the License at
12     *
13     * http://www.apache.org/licenses/LICENSE-2.0
14     *
15     * Unless required by applicable law or agreed to in writing, software
16     * distributed under the License is distributed on an "AS IS" BASIS,
17     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18     * See the License for the specific language governing permissions and
19     * limitations under the License.
20     */
21    
22     package net.douglasthrift.anttasks;
23    
24     import java.io.ByteArrayInputStream;
25     import java.io.IOException;
26     import java.util.ArrayList;
27    
28     import org.apache.tools.ant.Task;
29     import org.apache.tools.ant.taskdefs.Zip;
30     import org.apache.tools.zip.ZipOutputStream;
31    
32     public class UnixZip extends Zip
33     {
34     public static class Symlink extends Task
35     {
36     private String link;
37     private String resource;
38    
39     public void setLink(String link)
40     {
41     this.link = link;
42     }
43    
44     public void setResource(String resource)
45     {
46     this.resource = resource;
47     }
48     }
49    
50     private ArrayList<Symlink> symlinks = new ArrayList<Symlink>();
51    
52     public Symlink createSymlink()
53     {
54     Symlink symlink = new Symlink();
55    
56     this.symlinks.add(symlink);
57    
58     return symlink;
59     }
60    
61     protected void finalizeZipOutputStream(ZipOutputStream output) throws IOException
62     {
63     for (Symlink symlink: symlinks)
64     this.zipFile(new ByteArrayInputStream(symlink.resource.getBytes()), output, symlink.link, System.currentTimeMillis(), null, 0120755);
65     }
66     }

Properties

Name Value
svn:eol-style native
svn:keywords Id