Added "writeString(String string, String charsetName)" method
This commit is contained in:
parent
3c05bed908
commit
e56d39fea0
|
@ -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
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue