00001 package org.gridlab.gat.io;
00002
00003 import java.io.IOException;
00004 import java.io.InputStream;
00005
00006 import org.gridlab.gat.GATContext;
00007 import org.gridlab.gat.Preferences;
00008 import org.gridlab.gat.engine.GATEngine;
00009 import org.gridlab.gat.io.cpi.FileInputStreamCpi;
00010 import org.gridlab.gat.monitoring.Monitorable;
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 public abstract class FileInputStream extends InputStream implements Monitorable {
00026 protected GATContext gatContext;
00027 protected Preferences preferences;
00028 protected File file;
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 protected FileInputStream(GATContext gatContext, Preferences preferences,
00058 File file) throws IOException {
00059 this.gatContext = gatContext;
00060 this.preferences = preferences;
00061 this.file = file;
00062 }
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089 public FileInputStream create(GATContext gatContext,
00090 File file) throws IOException {
00091 return create(gatContext, null, file);
00092 }
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121 public FileInputStream create(GATContext gatContext, Preferences preferences,
00122 File file) throws IOException {
00123 GATEngine gatEngine = GATEngine.getGATEngine();
00124
00125 Object[] array = new Object[1];
00126 array[0] = file;
00127
00128 FileInputStreamCpi f = (FileInputStreamCpi) gatEngine.getAdaptor(
00129 FileInputStreamCpi.class, gatContext, preferences, array);
00130
00131 return f;
00132 }
00133 }