📄 nullserialport.java
字号:
throw new IllegalStateException("Port Closed"); } return parity; } /** * Method declaration * * * @param flowcontrol * * @throws UnsupportedCommOperationException * * @see */ public void setFlowControlMode(int flowcontrol) throws UnsupportedCommOperationException { if (closed) { throw new IllegalStateException("Port Closed"); } this.flowcontrol = flowcontrol; } /** * Method declaration * * * @return * * @see */ public int getFlowControlMode() { if (closed) { throw new IllegalStateException("Port Closed"); } return flowcontrol; } /** * Method declaration * * * @param baudrate * @param dataBits * @param stopBits * @param parity * * @throws UnsupportedCommOperationException * * @see */ public void setSerialPortParams(int baudrate, int dataBits, int stopBits, int parity) throws UnsupportedCommOperationException { if (closed) { throw new IllegalStateException("Port Closed"); } this.baudrate = baudrate; this.parity = parity; this.dataBits = dataBits; this.stopBits = stopBits; } /** * Method declaration * * * @param millis * * @see */ public void sendBreak(int millis) { if (closed) { throw new IllegalStateException("Port Closed"); } } private boolean dtr = true; /** * Method declaration * * * @param dtr * * @see */ public void setDTR(boolean dtr) { if (closed) { throw new IllegalStateException("Port Closed"); /* * Illegal to change state of DTR when hardware flow control is on */ } if ((flowcontrol & FLOWCONTROL_RTSCTS_IN) == FLOWCONTROL_RTSCTS_IN) { return; } this.dtr = dtr; } /** * Method declaration * * * @return * * @see */ public boolean isDTR() { if (closed) { throw new IllegalStateException("Port Closed"); } return dtr; } private boolean rts = true; /** * Method declaration * * * @param rts * * @see */ public void setRTS(boolean rts) { if (closed) { throw new IllegalStateException("Port Closed"); /* * Illegal to change state of RTS when hardware flow control is on */ } if ((flowcontrol & FLOWCONTROL_RTSCTS_IN) == FLOWCONTROL_RTSCTS_IN) { throw new IllegalStateException("Cannot modify RTS when Hardware flowcontrol is on."); } this.rts = rts; } /** * Method declaration * * * @return * * @see */ public boolean isRTS() { if (closed) { throw new IllegalStateException("Port Closed"); } return rts; } /** * Method declaration * * * @return * * @see */ public boolean isCTS() { if (closed) { throw new IllegalStateException("Port Closed"); } return true; } /** * Method declaration * * * @return * * @see */ public boolean isDSR() { if (closed) { throw new IllegalStateException("Port Closed"); } return true; } /** * Method declaration * * * @return * * @see */ public boolean isRI() { if (closed) { throw new IllegalStateException("Port Closed"); } return false; } /** * Method declaration * * * @return * * @see */ public boolean isCD() { if (closed) { throw new IllegalStateException("Port Closed"); } return true; } /** * Method declaration * * * @param lsnr * * @throws TooManyListenersException * * @see */ public synchronized void addEventListener(SerialPortEventListener lsnr) throws TooManyListenersException { if (closed) { throw new IllegalStateException("Port Closed"); } } /** * Method declaration * * * @see */ public synchronized void removeEventListener() { if (closed) { throw new IllegalStateException("Port Closed"); } } /** * Method declaration * * * @param notify * * @see */ public synchronized void notifyOnDataAvailable(boolean notify) { if (closed) { throw new IllegalStateException("Port Closed"); } } /** * Method declaration * * * @param notify * * @see */ public synchronized void notifyOnOutputEmpty(boolean notify) { if (closed) { throw new IllegalStateException("Port Closed"); } } /** * Method declaration * * * @param notify * * @see */ public synchronized void notifyOnCTS(boolean notify) { if (closed) { throw new IllegalStateException("Port Closed"); } } /** * Method declaration * * * @param notify * * @see */ public synchronized void notifyOnDSR(boolean notify) { if (closed) { throw new IllegalStateException("Port Closed"); } } /** * Method declaration * * * @param notify * * @see */ public synchronized void notifyOnCarrierDetect(boolean notify) { if (closed) { throw new IllegalStateException("Port Closed"); } } /** * Method declaration * * * @param notify * * @see */ public synchronized void notifyOnRingIndicator(boolean notify) { if (closed) { throw new IllegalStateException("Port Closed"); } } /** * Method declaration * * * @param notify * * @see */ public synchronized void notifyOnOverrunError(boolean notify) { if (closed) { throw new IllegalStateException("Port Closed"); } } /** * Method declaration * * * @param notify * * @see */ public synchronized void notifyOnParityError(boolean notify) { if (closed) { throw new IllegalStateException("Port Closed"); } } /** * Method declaration * * * @param notify * * @see */ public synchronized void notifyOnFramingError(boolean notify) { if (closed) { throw new IllegalStateException("Port Closed"); } } /** * Method declaration * * * @param notify * * @see */ public synchronized void notifyOnBreakInterrupt(boolean notify) { if (closed) { throw new IllegalStateException("Port Closed"); } } /* finalizer. so we can close the comm port and release native resources */ /** * Method declaration * * * @throws Throwable * * @see */ protected void finalize() throws Throwable {} private boolean closed = false; /** * Method declaration * * * @see */ public void close() { closed = true; /* * WARNING *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING * AFTER YOU ARE DONE WITH YOUR OWN close() processing, * YOU MUST MAKE THIS CALL TO CommPort's close(). OTHERWISE * CommPort's HOUSEKEEPING WILL FAIL. * WARNING *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING */ super.close(); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -