public void setType ( int type ) throws IOException , ServerException { localServer . setTransferType ( type ) ; String typeStr = null ; switch ( type ) { case Session . TYPE_IMAGE : typeStr = "I" ; break ; case Session . TYPE_ASCII : typeStr = "A" ; break ; case Session . TYPE_LOCAL : typeStr = "E" ; break ; case Session . TYPE_EBCDIC : typeStr = "L" ; break ; default : throw new IllegalArgumentException ( "Bad type: " + type ) ; } Command cmd = new Command ( "TYPE" , typeStr ) ; try { controlChannel . execute ( cmd ) ; } catch ( FTPReplyParseException rpe ) { throw ServerException . embedFTPReplyParseException ( rpe ) ; } catch ( UnexpectedReplyCodeException urce ) { throw ServerException . embedUnexpectedReplyCodeException ( urce , "Server refused changing transfer mode" ) ; } this . session . transferType = type ; }
Sets transfer type .