wood burning stoves 2.0*
The moose likes I/O and Streams and the fly likes java.io.IOException at out.write() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "java.io.IOException at out.write()" Watch "java.io.IOException at out.write()" New topic
Author

java.io.IOException at out.write()

Varun varshney
Greenhorn

Joined: Nov 17, 2008
Posts: 4
Hey,
I am working on an application which sends an image captured from the cellphone camera to a server after a fixed interval of time.
Currently,I am testing a way to send an image to a PC server.
I am trying to make the following code work but it gives

"java.io.IOException"
at the line
"out.write(rgbByteArray)" at the DataTransmitter.java

The DataTransmitter.java code is is handled by a midlet.and for image capture it uses CameraCanvas.java and for detecting devices it uses ServiceDiscoverer.java and DeviceDiscoverer.java...The bluetooth n device discovery are all working fine.
Problem comes when i the "out.write()" line is executed.

The Server code is :



The DataTransmitter.java code is It is handled by a midlet.and for image capture it uses CameraCanvas.java and for detecting devices it uses ServiceDiscoverer.java and DeviceDiscoverer.java)
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8994
    
    9

Welcome to the JavaRanch.
You must have missed our naming policy when registering. In short, your name must be a real (or at least real-sounding) first and last name, separated by a space. You can change your displayed name here.
It will help us help you if you isolate the problem in your code. Few of us have the time to read through 100's of lines of code.


[How To Ask Questions On JavaRanch]
Varun varshney
Greenhorn

Joined: Nov 17, 2008
Posts: 4
Hey Joe,
Sorry I will take care about that.
Actually I am trying to send an image captured from a sony ericsson s60 phone camera to a PC Server via bluetooth.
The problem which I am facing now is that-> the image comes out to be black on the server side.(black as in a totally black rectangle).

The client side image sending code is
:


The Server side code to receive n convert is:


Now the file a.png is totally black.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18985
    
    8

You have two unrelated pieces of code there. The first reads 1024 bytes (why that number?) from somewhere into a byte array. The second does something with images. Was it supposed to use that byte array in some way?
Varun varshney
Greenhorn

Joined: Nov 17, 2008
Posts: 4
Hey paul..
I have changed the byte code reading part on the server side to
:

then it creates an image using this imageBytes array by :


The client side code remains same:
where the byte array from the CameraCanas class is converted to pixel byte array by

This rgbByte pixel array is send to the server via Outpust stream using


Now the problem faced is :
When i print the number of bytes read i.e 'b' it prints the bytes count till
a certain value and then the code runs into a non yielding state... no printing of b or anything after that..and neither a file a.png is created.
for eg the output of b is :
328
328
328
.
.
.
.
.
328
32
(. denotes a series of 3 digit numbers)
After this the program gets stuck!!
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18985
    
    8

You haven't fixed your screen name yet.
Varun varshney
Greenhorn

Joined: Nov 17, 2008
Posts: 4
Sorry again..
done now !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.io.IOException at out.write()