thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 熊峰 <xiongfeng0...@gmail.com>
Subject About Thrift binary data type
Date Tue, 17 Jul 2012 09:03:16 GMT
Hi guys!I have a problem with Thrift binary data type. Both server side and
client side of my application use Java. I defined a service in my IDL file
as follow:
service ImageService {
binary getImage();
}
My implementation as follow:
public ByteBuffer getImage() throws TException {
ByteBuffer buf_ = null;
try {
FileInputStream fin = new FileInputStream("E:\\2.jpg");
int size = fin.available();
buf_ = ByteBuffer.allocate(size);
FileChannel fcin = fin.getChannel();
int count = fcin.read(buf_);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
 return buf_;
}
But when i call getImage() method in my client and got the return value as
ByteBuffer like this:
ByteBuffer _buf = client.getImage();
I find that the _buf object stored nothing in it.  I really feel confused.
Who can help? Many Thanks!!!

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message