Why do my file is stored and has the correct dimension but I cannot open it
hi,
I want to store an image from an inputStream to my harddisk. The created file (image) has the same dimensions of the original image (8kb), but I cannot open it with photoshop or other image editors. Something is wrong in the data... can you give me some tips ?
thanks
File outputfile = new File("/Library/Tomcat/webapps/ROOT/WEB-INF/classes/saved2.png");
try {
//File f=new File("outFile.java");
//InputStream inputStream= new FileInputStream("InputStreamToFile.java");
OutputStream out=new FileOutputStream(outputfile);
byte buf[]=new byte[1024];
int len;
while((len=inputStream.read(buf))>0)
out.write(buf,0,len);
out.close();
inputStream.close();
System.out.println("\nFile is created");
catch (IOException e){
}
I've solved it with this code:
InputStream inputStream = req.getInputStream();
BufferedImage img = ImageIO.read(inputStream);
File outputfile = new File("/Library/Tomcat/webapps/ROOT/WEB-INF/classes/saved2.png");
//storing the image to file system.
if (outputfile.isDirectory()) {
ImageIO.write(img, "png", outputfile);
} else {
outputfile.mkdirs();
ImageIO.write(img, "png", outputfile);
} catch (Exception e) {
System.out.println(e.getMessage());
}
Similar Messages
-
my ipad says "connexion a l'Itunes Store impossible" when I click the App Store button. So, I cannot have access to the Apps. I have internet connection and I can use my emails and the safari. Please advise.
Try this:
1. Settings>General>Date & Time>Turn off set automatically
2. Set date one year ahead
3. Go back to iTunes and try again.
4. You will get the same error.
5. Go back to settings general date and time and turn back on 'set automatically'
Try connecting to iTune Store again. -
I rented a movie on Itunes last night and I watched half of it before falling asleep. Today I tried to open the movie and watch the last half but I cannot find it. It has been less than 24 hours since I rented it. Where can I find the movie?
I found my answer in another Thread and it worked... so for anyone who needs it, here it is:
https://discussions.apple.com/message/19134562#19134562
Had the same problem and spoke with Apple Support. They had me reset the System Management Controller:
Shut down the computer. With the computer off, on the left hand side of the keyboard press shift+control+option along with the power button simultaneously and release. Wait 5-10 seconds and restart the computer.
This solved my problem and I was immediately able to purchase, download, and play an HD movie from iTunes w/o any error message. -
i am trying to import my libary onto a new computor, the file, my library that is, is in my music and in the itunes folder but it doesnt open up when l open itunes would appreciate some help with the import cheers
Hey samanthaluca,
Sounds like you want to move your music library to a new computer. I'd follow the steps in this article from the begining to make sure the import goes smoothly:
iTunes: How to move your music to a new computer
http://support.apple.com/kb/HT4527
Cheers,
Delgadoh -
I need to update specific records(of variable lengths) in a file. I can get the correct record but when I update it(add or change info), it overwrites part of the record following it. I am using labview 6.0. I need to be able to insert information into the middle of a file without disturbing the data before and after
It's hard to give more specifics without more detail, but in general you're going to need to read in the entire file, split it into three pieces (everything before the record of interest, the record itself, and everything after the record of interest), modify the record, reassemble the three pieces in proper order, and write the whole thing back to the file.Of course if the file is very large you might not want to actually implement it this way, but conceptually at least, this is what you are looking at.If this file some sort of proprietary format?Mike...PS: this type of issue is why I really like databases...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps -
Trying to restore after getting a new hard drive. I can see the backup on the Time Capsule and on the correct date but it is Greyed out. That is it wont let me open it and restore the machine. Have tried also Migration Assistant, no luck.
https://discussions.apple.com/thread/5210788?tstart=0
At startup hold down the Command+Option/Alt+r keys until you see a globe on the screen. Then use disk utility to partition and format the drive HSF+ and then select Reinstall Mac OS X. whatever version of OS X that originally came on your system will be installed and then you can upgrade back to Mavericks. -
Trying to start my IMac click on my admin icon and enter the correct password but then flashes to white screen and back to sign in, my desktop wont come on ... help!!!!
Boot to the Recovery HD:
Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
When the menubar appears select Terminal from the Utilities menu. Enter resetpassword at the prompt and press RETURN. Follow instructions in the dialog window that will appear.
Or see Reset a Mac OS X 10.7 Lion Password and OS X Lion- Apple ID can be used to reset your user account password. -
I have incorrectly entered an email address that is not valid. I have requested the change to the correct email but if cannot verify it as the verification email is being sent to the email address that I entered incorrectly and is invalid. Help!
Hey Givemepaperandapen,
Thanks for using Apple Support Communities.
For more information, take a look at:
Apple ID: Associating and verifying email addresses with your Apple ID
http://support.apple.com/kb/he68
How to edit or change your Apple ID and primary email address
Have a nice day,
Mario -
I bought the new Ipod nano, and the radio is not working. I live in the USA, and has being setting in "America" zone, but is not working!! I plugged the headphones, and I tried in different places, and I not working!!!
What could I do?Check if the headphones are inserted all the way in till you hear a click. Hope this helps!
-
I bought and paied the Creative Cloud (€19 por month) but when I open Photoshop appears the message: "continue the trial". Why?
Sign in, activation, or connection errors | CS5.5 and later
Mylenium -
I purchased several books but on itunes but cannot open them on my iphone 4S. I purchased one without problem. However, the next several appear in my library but have a solid black line on the cover as though they haven't downloaded. When I check my itunes account for possible downloads, it shows everything has been done. Any suggestions?
Could you take a screenshot of this line?
Press home and sleep button at the same time I believe. -
i cannot open itunes to update apps on my iphone. i did the command prompt-netsh winsock reset, still cannot open itunes.
Try following steps and test one at a time:
1. Check to see if this file APSDaemon.exe is the problem here.
Close your iTunes.
Press Ctrl-Alt-Del key and choose Task Manager. In the "Processes" Tab, select the file APSDaemon.exe and click End Prosses button, then close the task manager window.
Now open itunes and see if it is working?
If that works, to prevent having to do the same process everytime you restart Windows, go to. START button, type in
MSCONFIG
Hit ENTER
Click STARTUP Tab, Uncheck "Apple Push", click OK.
Restart Windows.
2. If that fails or you don't see ApsDaemon.exe in the Processes, refer to following article to remove SC files:
http://support.apple.com/kb/TS2363
3. If that fails, repair or reinstall your Quicktime. START / CONTROL PANEL / ADD N REMOVE PROGRAMS / hightlight QUICKTIME, click CHANGE or UNINSTALL then REPAIR. -
It's asking for a password, i'm putting in the correct one and it's still not working. it says mail cant connect to the account "...."
please help!If you've activated 2-step verification, you need to generate an application-specific password in your Google account and enter it instead of the login password you use on the website.
-
I was able to download Firefox 5. When I transferred it to my applications folder, it states that I cannot open, because my architecture doesn't support it. Why doesn't it state that when I looked up the minimum requirements? According to that, I should be able to use it.
Beginning with Firefox 4, Macs must have an Intel x86 processor; your system is a PPC Mac.
*System Requirements: [https://www.mozilla.org/en-US/firefox/4.0/system-requirements/index.html Firefox 4], [https://www.mozilla.org/en-US/firefox/5.0/system-requirements/index.html Firefox 5], [https://www.mozilla.org/en-US/firefox/6.0/system-requirements/index.html Firefox 6], [https://www.mozilla.org/en-US/firefox/7.0/system-requirements/index.html Firefox 7]
The good news is that Firefox 3.6.23 still supports the PPC Mac architecture. The bad news is that support for the Firefox 3.6.x series is likely to end in the first quarter of 2012.
*Download Firefox 3.6.23: https://www.mozilla.org/en-US/firefox/all-older.html
*Installing Firefox on a Mac: http://support.mozilla.com/en-US/kb/Installing+Firefox+on+Mac
*System requirements: [https://www.mozilla.org/en-US/firefox/3.6/system-requirements/index.html Firefox 3.6.x]
You can try the third-party product '''''TenFourFox''''' that supports PPC Macs. The product is based on Firefox released versions. All support is provided by the developer, not by this site:
*Home page: http://www.floodgap.com/software/tenfourfox/
*Developer's blog: http://tenfourfox.blogspot.com/
'''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.''' -
Filename after scanning has the correct month but the wrong day
is there a way to change the default settings and or correct the date/name of a scanned document. The file name of the scanned document reflects the scan profile plus the year...month..day...hour(in military)...minute...second. The day is incorrect. What can be done to correct this. The computer time is correct.
I have tried two separate scanners with the same results. thanksThis is NOT RESOLVED and is a BUG (is there a better place to post a bug?). I will explain the issue and how to duplicate it.
Adobe Acrobat X Pro 10.0.1
When scanning to PDF via an action the file name is incorrectly generated one day ahead of the current.
Example: A file scanned in today (03/01/11) shows the following filename:
Scans_201132201258
The file name structure breaks down like this:
(Scans=name of action used to generate scan)_(2011=year)(3=month)(2=INCORRECT DATE / current date +1)(201258=20hrs 12min 58sec)
Here the EXACT steps I used to create this issue:
File > Create > PDF from Scanner > Configure Presets
Options > Select my scanner
Presets: Autodetect Color Mode
Optimize Scanned PDF checked (probably not important to issue replication)
Make Searchable checked (probably not important to issue replication)
Save
File > Action Wizard > Create New Action
Starts with: A Scanned Document > Autodetect Color Mode
No Steps
Save to: A folder on my computer
Options box to the right of Save To selection (set to default settings)
Keep original file names checked
Save File(s) as Adobe PDFs checked
Overwrite existing files checked
Saved action as 'Scans'
File > Action Wizard > 'Scans'
File scans and opens with filename incorrect
Maybe you are looking for
-
I am writing to say I experienced the worse customer service ever from one of your stores!!! Not just the reps but both the day and night manager both were very rude to me, I am not going to saying I was a happy camper in talking to them but you are
-
How do i create a new email address?
how do i create a new email address in Mail?
-
Logical System Change for Production System
Hi experts We have new CRM and BI project. Logical System name of our ERP production system is not in naming standart. So we want to change logical system name and run BDLS in production system. Is there any risk about this prosedure? Best Regards..
-
Open a document in same window
Hi We have a requirement to open a document in same window(lower part) when a link or button is clicked. Is there any sample explaining how to do that?
-
Can't open boot device??? On sparc 7
Hi I'm new to Solaris, please be patient. I got a ultra 1 machine and tried to upgrade the hard drive. I installed an IBM 4.55 GB sca drive. When I boot this message comes up. Boot device /sbus/espdma/csp/sd@0,0:a File and args: -F cprbooter cprboot