code: private ScpEntry parseMessage() throws IOException {
          int ack = checkAck();
          if ( ack == -1 ) return null; // end of stream
  
          char type = (char) ack;
  
          ScpEntry scpEntry = null;
          if ( type == 'E' ) {
              scpEntry = ScpEntry.newEndOfDirectory();
              readMessageSegment(); // read and discard the \n
          }
          else if ( type == 'C' || type == 'D' ) {
              String mode = readMessageSegment();
              String sizeString = readMessageSegment();
              if ( sizeString == null ) return null;
              long size = Long.parseLong( sizeString );
              String name = readMessageSegment();
              if ( name == null ) return null;
  
              scpEntry = type == 'C'
                      ? ScpEntry.newFile( name, size, mode )
                      : ScpEntry.newDirectory( name, mode );
          }
          else {
              throw new UnsupportedOperationException( "unknown protocol message type " + type );
          }
  
          logger.debug( "read '{}'", scpEntry );
          return scpEntry;
      }
docs: Parses SCP protocol messages, for example:
  
  <pre>
  File:          C0640 13 test.txt
  Directory:     D0750 0 testdir
  End Directory: E
  </pre>
  
  @return An ScpEntry for a file (C), directory (D), end of directory (E),
  or null when no more messages are available.
  @throws IOException