public File inFile = null;
+ public byte[] bytes; // from JavaScript
+
/**
* a viewport associated with the current file operation. May be null. May
* move to different object.
public FileParse(String fileStr, DataSourceType sourceType)
throws MalformedURLException, IOException
{
+
+ this(null, fileStr, sourceType, false);
+ }
+
+ public FileParse(File file, DataSourceType sourceType)
+ throws MalformedURLException, IOException
+ {
+
+ this(file, file.getPath(), sourceType, true);
+ }
+
+ private FileParse(File file, String fileStr, DataSourceType sourceType,
+ boolean isFileObject) throws MalformedURLException, IOException
+ {
+
+ /**
+ * @j2sNative
+ *
+ * this.bytes = file && file._bytes;
+ *
+ */
this.dataSourceType = sourceType;
error = false;
if (sourceType == DataSourceType.FILE)
{
- if (checkFileSource(fileStr))
+
+ if (bytes != null)
+ {
+ // this will be from JavaScript
+ inFile = file;
+ dataIn = new BufferedReader(new StringReader(new String(bytes)));
+ dataName = fileStr;
+ }
+ else if (checkFileSource(fileStr))
{
String suffixLess = extractSuffix(fileStr);
if (suffixLess != null)
{
// pass up the reason why we have no source to read from
throw new IOException(MessageManager.formatMessage(
- "exception.failed_to_read_data_from_source", new String[]
+ "exception.failed_to_read_data_from_source",
+ new String[]
{ errormessage }));
}
error = false;