Reading files from hardDisk and storing as variables?

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 1592 Views - Last Post: 17 July 2012 - 02:36 PM Rate Topic: -----

#1 Courtney2012  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 50
  • Joined: 16-March 12

Reading files from hardDisk and storing as variables?

Posted 16 July 2012 - 07:17 PM

Is there a way of reading a video file from your hard disk and storing it as a variable. I tryed googleing it but I keept getting stuff about reading the file and playing it at the same time. All I want to do is store it.

can I do this with ObjectInputStream()?
Is This A Good Question/Topic? 0
  • +

Replies To: Reading files from hardDisk and storing as variables?

#2 Ghlavac  Icon User is offline

  • D.I.C Addict

Reputation: 84
  • View blog
  • Posts: 519
  • Joined: 14-January 09

Re: Reading files from hardDisk and storing as variables?

Posted 16 July 2012 - 08:28 PM

You aren't finding an obvious answer to this because you're trying to be too complicated, the closest you're going to get to this is storing it in an array and keeping a reference to that array around, however..

Its just going to eat a crapton of ram.
Was This Post Helpful? 0
  • +
  • -

#3 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7807
  • View blog
  • Posts: 13,203
  • Joined: 19-March 11

Re: Reading files from hardDisk and storing as variables?

Posted 16 July 2012 - 08:36 PM

What do you want to do with this sound file, beyond saving it as a variable? What's this in aid of?

Any tutorial that shows you how to load a sound file and play it back will also show you how to load it and store it for later, but what do you want to do with the sound file once you have it?
Was This Post Helpful? 0
  • +
  • -

#4 Courtney2012  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 50
  • Joined: 16-March 12

Re: Reading files from hardDisk and storing as variables?

Posted 17 July 2012 - 08:30 AM

I am hoping to save it to a variable and then write that variable to the hard disk at a later date.

so it could become almost like a music or video library. I would probobly add a simple JFrame with a cupple buttons to interact with it and a JList to display them. I am planing to serialize the class at the end to store the library.
Was This Post Helpful? 0
  • +
  • -

#5 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10596
  • View blog
  • Posts: 39,259
  • Joined: 27-December 08

Re: Reading files from hardDisk and storing as variables?

Posted 17 July 2012 - 08:36 AM

You would really be better working with ZIP files than serialization for this task.
Was This Post Helpful? 0
  • +
  • -

#6 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7807
  • View blog
  • Posts: 13,203
  • Joined: 19-March 11

Re: Reading files from hardDisk and storing as variables?

Posted 17 July 2012 - 08:40 AM

If you're just moving it around on the disk, just move the file around and don't worry about loading the content.
Was This Post Helpful? 0
  • +
  • -

#7 Courtney2012  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 50
  • Joined: 16-March 12

Re: Reading files from hardDisk and storing as variables?

Posted 17 July 2012 - 09:02 AM

I don't quite understand how that zip thing works. Is it just writing a variable to a zip file?

are variables sored in ram because if this is true than do I need to find another way of doing this?
Was This Post Helpful? 0
  • +
  • -

#8 Courtney2012  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 50
  • Joined: 16-March 12

Re: Reading files from hardDisk and storing as variables?

Posted 17 July 2012 - 09:26 AM

I want to hold it in a way that it can not be read
Was This Post Helpful? 0
  • +
  • -

#9 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10596
  • View blog
  • Posts: 39,259
  • Joined: 27-December 08

Re: Reading files from hardDisk and storing as variables?

Posted 17 July 2012 - 09:30 AM

May I ask why? Any modern tool to do this (iTunes, Windows Media Player, etc.), all hold the files in readable formats. If you serialize a bunch of video files, you will encounter OutOfMemoryErrors when unserializing them. Heck, you'll probably encounter them trying to even load the video files.
Was This Post Helpful? 0
  • +
  • -

#10 Courtney2012  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 50
  • Joined: 16-March 12

Re: Reading files from hardDisk and storing as variables?

Posted 17 July 2012 - 09:41 AM

I want to hold it in a way that it can not be read.
Was This Post Helpful? 0
  • +
  • -

#11 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7807
  • View blog
  • Posts: 13,203
  • Joined: 19-March 11

Re: Reading files from hardDisk and storing as variables?

Posted 17 July 2012 - 10:04 AM

I think you need to be more clear on what you're trying to build here.

We're assuming that you're talking about some ordinary use case, like a media player or something, and evidently that's wrong.
What exactly are you up to?
Was This Post Helpful? 0
  • +
  • -

#12 Courtney2012  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 50
  • Joined: 16-March 12

Re: Reading files from hardDisk and storing as variables?

Posted 17 July 2012 - 10:21 AM

Im sorry, I guess I have been rather unclear. I would like to make a bisic GUI so that allows me to select media files and create a unreadable data object from which this GUI can later go to and reconstruct the files.
Was This Post Helpful? 0
  • +
  • -

#13 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10596
  • View blog
  • Posts: 39,259
  • Joined: 27-December 08

Re: Reading files from hardDisk and storing as variables?

Posted 17 July 2012 - 10:33 AM

Quote

I want to hold it in a way that it can not be read.

Yes. And I'm asking why is it important for the file not to be readable. Serialization really isn't the best way to accomplish this. It would be much better to actually encrypt the ZIP file than to serialize the Objects.
Was This Post Helpful? 0
  • +
  • -

#14 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7807
  • View blog
  • Posts: 13,203
  • Joined: 19-March 11

Re: Reading files from hardDisk and storing as variables?

Posted 17 July 2012 - 10:37 AM

View PostCourtney2012, on 17 July 2012 - 12:21 PM, said:

Im sorry, I guess I have been rather unclear. I would like to make a bisic GUI so that allows me to select media files and create a unreadable data object from which this GUI can later go to and reconstruct the files.



To what end? What purpose will this serve? When will I reach for this tool, and what will I be trying to accomplish?
Was This Post Helpful? 0
  • +
  • -

#15 Courtney2012  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 50
  • Joined: 16-March 12

Re: Reading files from hardDisk and storing as variables?

Posted 17 July 2012 - 02:21 PM

let pretend that I own a small buisness and have confidential files that I don't want my staff to open. this would function to stop somone from being able to execute the given file or even beeing able to tell what type of file it is if they were to right click and look under properties.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2