[Beepcore-java-commits] CVS: beepcore-java/src/org/beepcore/beep/profile/echo EchoProfile.java,1.8,1
Status: Beta
Brought to you by:
huston
|
From: Huston F. <hu...@us...> - 2001-10-31 00:32:40
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/echo
In directory usw-pr-cvs1:/tmp/cvs-serv24137/src/org/beepcore/beep/profile/echo
Modified Files:
EchoProfile.java
Log Message:
New *DataStream
Index: EchoProfile.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/echo/EchoProfile.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** EchoProfile.java 2001/07/20 23:26:13 1.8
--- EchoProfile.java 2001/10/31 00:32:37 1.9
***************
*** 56,60 ****
{
Log.logEntry(Log.SEV_DEBUG, "EchoCCL StartChannel Callback");
! channel.setDataListener(this);
}
--- 56,60 ----
{
Log.logEntry(Log.SEV_DEBUG, "EchoCCL StartChannel Callback");
! channel.setMessageListener(this);
}
***************
*** 62,66 ****
{
Log.logEntry(Log.SEV_DEBUG, "EchoCCL CloseChannel Callback");
! channel.setDataListener(null);
channel.setAppData(null);
}
--- 62,66 ----
{
Log.logEntry(Log.SEV_DEBUG, "EchoCCL CloseChannel Callback");
! channel.setMessageListener(null);
channel.setAppData(null);
}
***************
*** 84,103 ****
public void run() {
! byte[] buf = new byte[4096];
! ByteArrayOutputStream data = new ByteArrayOutputStream();
! DataStream ds = message.getDataStream();
! InputStream is = ds.getInputStream();
!
! while (true) {
try {
! int n = is.read(buf);
!
! if (n == -1) {
! break;
! }
!
! data.write(buf, 0, n);
! } catch (IOException e) {
message.getChannel().getSession().terminate(e.getMessage());
return;
--- 84,94 ----
public void run() {
! OutputDataStream data = new OutputDataStream();
! InputDataStream ds = message.getDataStream();
! while (ds.isComplete() == false || ds.availableSegment()) {
try {
! data.add(ds.waitForNextSegment());
! } catch (InterruptedException e) {
message.getChannel().getSession().terminate(e.getMessage());
return;
***************
*** 105,110 ****
}
try {
! message.sendRPY(new ByteDataStream(data.toByteArray()));
} catch (BEEPException e) {
try {
--- 96,103 ----
}
+ data.setComplete();
+
try {
! message.sendRPY(data);
} catch (BEEPException e) {
try {
|