01: /*
02: * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05:
06: //
07: package com.sun.portal.ffj.deploy;
08:
09: import org.openide.TopManager;
10: import org.openide.ErrorManager;
11:
12: import java.io.*;
13:
14: //
15: public abstract class DeployAdapter implements Deploy {
16: public String getPackageName(String pathString, String separator) {
17: //
18: String retVal = null;
19:
20: int index = pathString.lastIndexOf(separator);
21: if (index != -1) {
22: retVal = pathString.substring(0, index);
23: }
24:
25: //
26: return retVal;
27: }
28:
29: public String getLeafName(String pathString, String separator) {
30: int index = pathString.lastIndexOf(separator);
31: return pathString.substring(index + 1);
32: }
33:
34: public void copy(File fSrc, File fDest) {
35: try {
36: BufferedInputStream bis = new BufferedInputStream(
37: new FileInputStream(fSrc));
38: BufferedOutputStream bos = new BufferedOutputStream(
39: new FileOutputStream(fDest));
40:
41: int i = bis.read();
42: while (i != -1) {
43: bos.write(i);
44: i = bis.read();
45: }
46:
47: bis.close();
48: bos.close();
49: } catch (IOException ioe) {
50: TopManager.getDefault().getErrorManager().notify(
51: ErrorManager.USER, ioe);
52: }
53: }
54: }
|