mil.dod.th.ose.linux.serial/src/java/mil/dod/th/ose/linux/physical/SerialPortInputStream.java
private int handleReadError(final int returnValue) throws IOException
    {
        if (returnValue == 0) // 0 bytes read
        {
            throw new IllegalStateException("No bytes read (rv=0), but not due to a known error");
        }
        if (returnValue == FileOperations.FO_READ_TIMEOUT)
        {
            throw new TimeoutException("Timeout reading byte from serial port");
        }
        else if (returnValue == FileOperations.FO_READ_FAILURE)
        {
            throw new IOException("Native read failed");
        }
        else if (returnValue == FileOperations.FO_SELECT_FAILURE)
        {
            throw new IOException("Native select failed");
        }
        else if (returnValue == FileOperations.FO_INVALID_ARG)
        {
            throw new IllegalArgumentException("Invalid argument sent to tryRead");
        }
        
        // should never reach this point
        assert false : String.format("Unexpected return value from tryRead = %d%n", returnValue);
        return -1;
    }
/**
     * Handle return values from the {@link FileOperations#readBuffer} native method.
     * 
     * @param returnValue
     *          The value that was returned by {@link FileOperations#readBuffer}
     * @return normally will throw exception, but if error isn't handled will return -1 and assert
     * @throws IOException
     *          thrown if the error is a file operation error (read, select) or timeout
     */
Handle return values from the  FileOperations#readBuffer native method.

@param returnValue
The value that was returned by  FileOperations#readBuffer
@return normally will throw exception, but if error isn't handled will return -1 and assert
@throws IOException
thrown if the error is a file operation error (read, select) or timeout
Handle return values from the FileOperations#readBuffer native method . @param returnValue The value that was returned by FileOperations#readBuffer @return normally will throw exception but if error isn ' t handled will return - 1 and assert @throws IOException thrown if the error is a file operation error ( read select ) or timeout
private int handleReadError(final int returnValue) throws IOException
    {
        if (returnValue == 0) 
        {
            throw new IllegalStateException("No bytes read (rv=0), but not due to a known error");
        }
        if (returnValue == FileOperations.FO_READ_TIMEOUT)
        {
            throw new TimeoutException("Timeout reading byte from serial port");
        }
        else if (returnValue == FileOperations.FO_READ_FAILURE)
        {
            throw new IOException("Native read failed");
        }
        else if (returnValue == FileOperations.FO_SELECT_FAILURE)
        {
            throw new IOException("Native select failed");
        }
        else if (returnValue == FileOperations.FO_INVALID_ARG)
        {
            throw new IllegalArgumentException("Invalid argument sent to tryRead");
        }
        assert false : String.format("Unexpected return value from tryRead = %d%n", returnValue);
        return -1;
    }
private int handleReadError ( final int returnValue ) throws IOException { if ( returnValue == 0 ) { throw new IllegalStateException ( "No bytes read (rv=0), but not due to a known error" ) ; } if ( returnValue == FileOperations . FO_READ_TIMEOUT ) { throw new TimeoutException ( "Timeout reading byte from serial port" ) ; } else if ( returnValue == FileOperations . FO_READ_FAILURE ) { throw new IOException ( "Native read failed" ) ; } else if ( returnValue == FileOperations . FO_SELECT_FAILURE ) { throw new IOException ( "Native select failed" ) ; } else if ( returnValue == FileOperations . FO_INVALID_ARG ) { throw new IllegalArgumentException ( "Invalid argument sent to tryRead" ) ; } assert false : String . format ( "Unexpected return value from tryRead = %d%n" , returnValue ) ; return - 1 ; }
Handle return values from the {@link FileOperations#readBuffer} native method.
Handle return values from the { @link FileOperations#readBuffer } native method .
// 0 bytes read // should never reach this point