01: package com.sun.portal.fabric.tasks;
02:
03: import java.io.FileInputStream;
04: import java.io.File;
05: import java.io.IOException;
06: import java.io.FileNotFoundException;
07:
08: /**
09: * $Id: DownloadInfo.java,v 1.2 2005/04/08 13:19:12 rg149970 Exp $
10: * Copyright 2004 Sun Microsystems, Inc. All
11: * rights reserved. Use of this product is subject
12: * to license terms. Federal Acquisitions:
13: * Commercial Software -- Government Users
14: * Subject to Standard License Terms and
15: * Conditions.
16: *
17: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
18: * are trademarks or registered trademarks of Sun Microsystems,
19: * Inc. in the United States and other countries.
20: */
21:
22: public class DownloadInfo {
23: private String mName = null;
24: private FileInputStream mInputStream = null;
25: private long mSize = 0;
26: private File mFile = null;
27:
28: public DownloadInfo(String fileName) throws FileNotFoundException {
29: mName = fileName; //here file name should be with absolute path
30: mFile = new File(mName);
31: mInputStream = new FileInputStream(mFile);
32: mSize = mFile.length();
33: }
34:
35: public long getSize() {
36: return mSize;
37: }
38:
39: public String getName() {
40: return mName;
41: }
42:
43: public byte[] readBytes(int readSize) throws IOException {
44: byte[] toRead = new byte[readSize];
45: mInputStream.read(toRead);
46: return toRead;
47: }
48:
49: public void cleanUp() {
50: try {
51: mInputStream.close();
52: } catch (IOException ioe) {
53: ;
54: }
55: }
56:
57: }
|