Added "writeString(String string, String charsetName)" method

This commit is contained in:
Alexey Sokolov 2014-01-24 09:15:19 +03:00
parent 3c05bed908
commit e56d39fea0
1 changed files with 16 additions and 0 deletions

View File

@ -24,7 +24,9 @@
*/ */
package jssc; package jssc;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.nio.charset.Charset;
/** /**
* *
@ -375,6 +377,20 @@ public class SerialPort {
return writeBytes(string.getBytes()); return writeBytes(string.getBytes());
} }
/**
* Write String to port
*
* @return If the operation is successfully completed, the method returns true, otherwise false
*
* @throws SerialPortException
*
* @since 2.8.0
*/
public boolean writeString(String string, String charsetName) throws SerialPortException, UnsupportedEncodingException {
checkPortOpened("writeString()");
return writeBytes(string.getBytes(charsetName));
}
/** /**
* Write int value (in range from 0 to 255 (0x00 - 0xFF)) to port * Write int value (in range from 0 to 255 (0x00 - 0xFF)) to port
* *