1 22 package org.netbeans.lib.cvsclient.response; 23 24 import java.io.*; 25 26 import org.netbeans.lib.cvsclient.event.*; 27 import org.netbeans.lib.cvsclient.util.*; 28 29 33 class MessageResponse implements Response { 34 35 private boolean terminating = false; 36 37 private String firstWord; 38 39 public MessageResponse() { 40 } 42 43 public MessageResponse(String initialWord) { 44 firstWord = initialWord; 45 } 46 47 53 public void process(LoggedDataInputStream dis, ResponseServices services) 54 throws ResponseException { 55 try { 56 ByteArray bytes = dis.readLineBytes(); 57 String line = bytes.getStringFromBytes(); 58 if (firstWord != null) { 59 line = firstWord + " " + line; } 61 terminating |= line.endsWith(SpecialResponses.SERVER_ABORTED); 62 terminating |= line.endsWith(SpecialResponses.SERVER_ABORTED_2); 63 terminating |= line.endsWith(SpecialResponses.SERVER_ABORTED_3); 64 terminating &= dis.available() == 0; MessageEvent event = new MessageEvent(this, line, bytes.getBytes(), false); 66 services.getEventManager().fireCVSEvent(event); 67 } 68 catch (EOFException ex) { 69 throw new ResponseException(ex, ResponseException.getLocalMessage("CommandException.EndOfFile", null)); } 71 catch (IOException ex) { 72 throw new ResponseException(ex); 73 } 74 } 75 76 83 public boolean isTerminalResponse() { 84 return terminating; 85 } 86 } | Popular Tags |