001// Copyright (c) FIRST and other WPILib contributors. 002// Open Source Software; you can modify and/or share it under the terms of 003// the WPILib BSD license file in the root directory of this project. 004 005package edu.wpi.first.hal.can; 006 007import edu.wpi.first.hal.CANStreamMessage; 008import java.io.IOException; 009 010public class CANStreamOverflowException extends IOException { 011 /** The messages. */ 012 private final CANStreamMessage[] m_messages; 013 014 /** The length of messages read. */ 015 private final int m_messagesRead; 016 017 /** 018 * Constructs a new CANStreamOverflowException. 019 * 020 * @param messages The messages 021 * @param messagesRead The length of messages read 022 */ 023 @SuppressWarnings("PMD.ArrayIsStoredDirectly") 024 public CANStreamOverflowException(CANStreamMessage[] messages, int messagesRead) { 025 super("A CAN Stream has overflowed. Data will be missed"); 026 this.m_messages = messages; 027 this.m_messagesRead = messagesRead; 028 } 029 030 @SuppressWarnings("PMD.MethodReturnsInternalArray") 031 public CANStreamMessage[] getMessages() { 032 return m_messages; 033 } 034 035 public int getMessagesRead() { 036 return m_messagesRead; 037 } 038}