Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.32 KB | None | 0 0
  1. private void commandDELETE()  {
  2.         try {
  3.             dataConnectionOutputStream.writeUTF(DELE);
  4.             String filename;
  5.             System.out.println("Entre com o nome do arquivo a ser deletado : ");
  6.             filename = bufferedReader.readLine();
  7.             dataConnectionOutputStream.writeUTF(filename);
  8.             String reply = dataConnectionInputStream.readUTF();
  9.             if (reply.equals(FILE_NOT_FOUND)) {
  10.                 System.out.println("Arquivo não encontrado no servidor.");
  11.             } else if (reply.equals(FILE_STATUS_OK)) {
  12.                 System.out.println("Tem certeza que quer deletar o arquivo? ");
  13.                 String option;
  14.                 option = bufferedReader.readLine();
  15.                     if (option.equals(NO)) {
  16.                         //dataConnectionOutputStream.flush();
  17.                         return;
  18.                     }
  19.                     if (option.equals(YES)){
  20.                        
  21.                        dataConnectionOutputStream.writeUTF(YES);
  22.                        
  23.                     }
  24.                 }  
  25.                    
  26.  
  27.                 System.out.println("Arquivo deletado com sucesso! ");
  28.             }
  29.        
  30.          catch (IOException ex) {
  31.             System.err.println("Não foi possível deletar o arquivo.");
  32.         }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement