Thread Subject: Load variable from java InputStream

Subject: Load variable from java InputStream

From: Ray

Date: 2 Sep, 2010 21:29:05

Message: 1 of 2

I'm picking out a single file from a zip file and creating a java InputStream which points to it using the following code:
PathName = 'somepath';
FileName = 'someZipFile';
% Open the zip file
zipJavaFile = java.io.File(strcat(PathName,FileName));
zipFile = org.apache.tools.zip.ZipFile(zipJavaFile);
% Pick out just the results data file.
results_file = zipFile.getEntry('results.mat');
% Set up the stream
results_stream = zipFile.getInputStream(results_file)

So now I'd like to read the contents of this MAT file into the variable workspace. I'm stumped (obviously). I can use the java "read" function to get the contents, but have no way to parse the raw data. Do I really need to use the unzip.m function to put the contents of the file into a temp directory and then use the built-in load function to load from that? Is there any way to trick "load" into using a java InputStream object instead of a string?

Thanks!

Subject: Load variable from java InputStream

From: Ray

Date: 14 Sep, 2010 15:48:06

Message: 2 of 2

Replying to my own message...

I've been running for a week or so just unzipping to a temporary directory. It doesn't feel as "clean", but it seems to be working fine and the performance is satisfactory.

Thanks!
Ray

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
inputstream Ray 2 Sep, 2010 17:34:05
java Ray 2 Sep, 2010 17:34:05
load Ray 2 Sep, 2010 17:34:05
mat Ray 2 Sep, 2010 17:34:05
rssFeed for this Thread

Contact us at files@mathworks.com