Source code: com/yaftp/utils/JavaPackage.java
1 /**
2 *
3 * CopyRights Jean-Yves MENGANT 1999,2000,2001,2002
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19 package com.yaftp.utils ;
20
21 import java.io.* ;
22
23 /**
24
25 Copyright Jean-Yves MENGANT 1998,1999,2000
26
27 define what a JavaPackage Is
28
29 @author Jean-Yves MENGANT
30
31 */
32
33 public class JavaPackage
34 implements java.io.Serializable {
35
36 // JAVA BEAN SERIALIZATION VERSION ID NUMBER
37 static final long serialVersionUID = UtilsVersion.CURRENT_PRODUCT_VERSION ;
38 //static final long serialVersionUID = 7252299136469104981L;
39
40 private static final String _URLSEPARATOR_ = "/" ;
41
42 private String _javaName ; // the Java Language form
43 private String _urlName ; // the URL form
44 private String _fileName ; // the native File Form
45
46 public static String toFileName( String in )
47 {
48 String returned = in.replace('.' , File.separatorChar ) ;
49 return returned + File.separator ;
50 }
51
52 public static String toUrlName( String in )
53 {
54 return ( toFileName(in) + _URLSEPARATOR_ ) ;
55 }
56
57 /** constructor assumes that package name is in Java form */
58 public JavaPackage( String packageName )
59 {
60 _javaName = packageName ;
61 _fileName = toFileName(_javaName) ;
62 _urlName = toUrlName(_javaName) ;
63 }
64
65 public String get_javaName()
66 { return _javaName ; }
67
68 public String get_urlName()
69 { return _urlName ; }
70
71 public String get_fileName()
72 { return _fileName ; }
73
74 }