Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.io.IOException at out.write()

 
Varun varshney
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 9258
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Varun varshney
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20769
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20769
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You haven't fixed your screen name yet.
 
Varun varshney
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry again..
done now !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic