Mercurial > hg > RemoteEditor > Eclipse
changeset 17:b409b85ab73f
*** empty log message ***
author | pin |
---|---|
date | Tue, 24 Oct 2006 19:14:11 +0900 |
parents | b8f407692ecf |
children | e87cae12907e |
files | bin/remoteeditor/editors/RemoteEditor.class bin/remoteeditor/network/REP.class bin/remoteeditor/network/RSocketEvent.class src/remoteeditor/editors/RemoteEditor.java src/remoteeditor/network/REP.java src/sample/merge/Merge.java src/sample/merge/Rep_Cmd.java |
diffstat | 7 files changed, 27 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/remoteeditor/editors/RemoteEditor.java Tue Oct 24 18:03:13 2006 +0900 +++ b/src/remoteeditor/editors/RemoteEditor.java Tue Oct 24 19:14:11 2006 +0900 @@ -65,7 +65,7 @@ } try { - rep.insert(line, length, lineText); + rep.insert(line, length, lineText); //insert, delete replace ‚ð s”‚Å”»’f } catch (Exception e) { e.printStackTrace(); }
--- a/src/remoteeditor/network/REP.java Tue Oct 24 18:03:13 2006 +0900 +++ b/src/remoteeditor/network/REP.java Tue Oct 24 19:14:11 2006 +0900 @@ -11,6 +11,8 @@ import org.eclipse.jface.window.Window; import org.eclipse.swt.widgets.Shell; +import sample.merge.Rep_Cmd; + public class REP implements Runnable{ @@ -108,6 +110,11 @@ public void insert(int offset, int length, String text) throws IOException { seqid = (byte)offset; sc.write(pack(buffer, REP_INSERT_CMD, sid, eid, seqid, lineno, text)); + try { + myCmdList.add(new Rep_Cmd(cmd, sid, eid, seqid, lineno, textsiz, text)); + } catch (Exception e) { + e.printStackTrace(); + } } public ByteBuffer pack(ByteBuffer buffer,int cmd, int sid, int eid, int seqid, int lineno, String text ) { @@ -131,9 +138,10 @@ static final int HEADER_SIZE = 24; - ByteBuffer header = ByteBuffer.allocateDirect(HEADER_SIZE); + //ByteBuffer header = ByteBuffer.allocateDirect(HEADER_SIZE); public void unpack(ByteBuffer buffer) throws IOException{ + ByteBuffer header = ByteBuffer.allocateDirect(HEADER_SIZE); long len; header.clear(); len = sc.read(header); // limit = read length @@ -153,21 +161,27 @@ lineno = header.getInt(); textsiz = header.getInt()/2; - buffer.limit(textsiz*2); - buffer.rewind(); - len = sc.read(buffer); // limit = read length + ByteBuffer testBuffer = ByteBuffer.allocateDirect(textsiz*2); + //buffer.limit(textsiz*2); + //buffer.rewind(); + len = sc.read(testBuffer); // limit = read length if (len !=HEADER_SIZE) { // this can't happen } - buffer.rewind(); + testBuffer.rewind(); for(int i=0;i<textsiz;i++) { - text +=buffer.getChar(); + text +=testBuffer.getChar(); } /*for(int i = 0; i < textsiz; i++){ readbyte[i] = buffer.get(); } string = new String(readbyte, 0, textsiz);*/ string = text; + try { + othersCmdList.add(new Rep_Cmd(cmd, sid, eid, seqid, lineno, textsiz, textBuffer)); + } catch (Exception e) { + e.printStackTrace(); + } } public void addSocketListener(RSocketListener socketListener){
--- a/src/sample/merge/Merge.java Tue Oct 24 18:03:13 2006 +0900 +++ b/src/sample/merge/Merge.java Tue Oct 24 19:14:11 2006 +0900 @@ -15,7 +15,7 @@ static final int REP_QUIT_CMD = 53; static final int REP_QUIT_ACK_CMD = 54; - private LinkedList inUserList; + private static LinkedList inUserList; private LinkedList inTokenList; private LinkedList outUserList;