test_class.declarator: adapter
test_class.modifier: private
test_class.original_string: private CameraStreamAdapter adapter;
test_class.type: CameraStreamAdapter
test_class.var_name: adapter
test_class.file: plugins/cameraserver/src/test/java/edu/wpi/first/shuffleboard/plugin/cameraserver/source/CameraStreamAdapterTest.java
test_class.identifier: CameraStreamAdapterTest
test_case.body: @Test
    public void testDeserialize() throws IOException {
      File file = File.createTempFile("test-recording", ".sbr");
      adapter.setCurrentFile(file);
      CameraServerData data = new CameraServerData("name", null, (1 << 15) / 100, Integer.MAX_VALUE);
      byte[] bytes = adapter.serialize(data);
      adapter.cleanUp();
      CameraServerData deserialize = adapter.deserialize(bytes, 0);
      deleteTempFiles(file);
      assertAll(
          () -> assertEquals(data.getName(), deserialize.getName(), "Wrong name"),
          () -> assertEquals(data.getFps(), deserialize.getFps(), "Wrong FPS"),
          () -> assertEquals(data.getBandwidth(), deserialize.getBandwidth(), "Wrong bandwidth"),
          () -> assertNull(deserialize.getImage(), "Image should be null (video file does not exist)")
      );
    }
test_case.class_method_signature: CameraStreamAdapterTest.testDeserialize()
test_case.full_signature: @Test public void testDeserialize()
test_case.identifier: testDeserialize
test_case.invocations: createTempFile setCurrentFile serialize cleanUp deserialize deleteTempFiles assertAll assertEquals getName getName assertEquals getFps getFps assertEquals getBandwidth getBandwidth assertNull getImage
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testDeserialize()
focal_class.declarator: log = Logger.getLogger(CameraStreamReader.class.getName())
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = Logger.getLogger(CameraStreamReader.class.getName());
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: savers = new ConcurrentHashMap<>()
focal_class.modifier: private final
focal_class.original_string: private final Map<String, CameraStreamSaver> savers = new ConcurrentHashMap<>();
focal_class.type: Map<String, CameraStreamSaver>
focal_class.var_name: savers
focal_class.declarator: readers = new ConcurrentHashMap<>()
focal_class.modifier: private final
focal_class.original_string: private final Map<String, CameraStreamReader> readers = new ConcurrentHashMap<>();
focal_class.type: Map<String, CameraStreamReader>
focal_class.var_name: readers
focal_class.declarator: newSaver = name -> new CameraStreamSaver(name, getCurrentFile())
focal_class.modifier: private final
focal_class.original_string: private final Function<String, CameraStreamSaver> newSaver = name -> new CameraStreamSaver(name, getCurrentFile());
focal_class.type: Function<String, CameraStreamSaver>
focal_class.var_name: newSaver
focal_class.file: plugins/cameraserver/src/main/java/edu/wpi/first/shuffleboard/plugin/cameraserver/source/CameraStreamAdapter.java
focal_class.identifier: CameraStreamAdapter
focal_class.class_method_signature: CameraStreamAdapter.CameraStreamAdapter()
focal_class.full_signature: public  CameraStreamAdapter()
focal_class.identifier: CameraStreamAdapter
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  CameraStreamAdapter()
focal_class.class_method_signature: CameraStreamAdapter.flush()
focal_class.full_signature: @Override public void flush()
focal_class.identifier: flush
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void flush()
focal_class.class_method_signature: CameraStreamAdapter.cleanUp()
focal_class.full_signature: @Override public void cleanUp()
focal_class.identifier: cleanUp
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void cleanUp()
focal_class.class_method_signature: CameraStreamAdapter.deserialize(byte[] buffer, int bufferPosition)
focal_class.full_signature: @Override public CameraServerData deserialize(byte[] buffer, int bufferPosition)
focal_class.identifier: deserialize
focal_class.modifiers: @Override public
focal_class.parameters: (byte[] buffer, int bufferPosition)
focal_class.return: CameraServerData
focal_class.signature: CameraServerData deserialize(byte[] buffer, int bufferPosition)
focal_class.class_method_signature: CameraStreamAdapter.getSerializedSize(CameraServerData value)
focal_class.full_signature: @Override public int getSerializedSize(CameraServerData value)
focal_class.identifier: getSerializedSize
focal_class.modifiers: @Override public
focal_class.parameters: (CameraServerData value)
focal_class.return: int
focal_class.signature: int getSerializedSize(CameraServerData value)
focal_class.class_method_signature: CameraStreamAdapter.serialize(CameraServerData data)
focal_class.full_signature: @Override public byte[] serialize(CameraServerData data)
focal_class.identifier: serialize
focal_class.modifiers: @Override public
focal_class.parameters: (CameraServerData data)
focal_class.return: byte[]
focal_class.signature: byte[] serialize(CameraServerData data)
focal_class.class_method_signature: CameraStreamAdapter.videoFilePath(File rootRecordingFile, String cameraName, int fileIndex)
focal_class.full_signature: public static String videoFilePath(File rootRecordingFile, String cameraName, int fileIndex)
focal_class.identifier: videoFilePath
focal_class.modifiers: public static
focal_class.parameters: (File rootRecordingFile, String cameraName, int fileIndex)
focal_class.return: String
focal_class.signature: String videoFilePath(File rootRecordingFile, String cameraName, int fileIndex)
focal_class.superclass: extends TypeAdapter<CameraServerData>
focal_method.body: @Override
    public CameraServerData deserialize(byte[] buffer, int bufferPosition) {
      int cursor = bufferPosition;
      final String name = readString(buffer, cursor);
      cursor += name.length() + SIZE_OF_INT;
      final byte fileNum = buffer[cursor];
      cursor++;
      final short frameNum = readShort(buffer, cursor);
      cursor += SIZE_OF_SHORT;
      final int bandwidth = readInt(buffer, cursor);
      cursor += SIZE_OF_INT;
      final double fps = readShort(buffer, cursor) / 100.0;
  
      CameraStreamReader reader = readers.computeIfAbsent(name, __ -> new CameraStreamReader(__, getCurrentFile()));
  
      return new LazyCameraServerData(name, fileNum, frameNum, () -> {
        try {
          reader.setFileNumber(fileNum);
          return reader.readFrame(frameNum);
        } catch (IOException e) {
          log.log(Level.WARNING, "Could not read frame " + frameNum, e);
          return null;
        }
      }, fps, bandwidth);
    }
focal_method.class_method_signature: CameraStreamAdapter.deserialize(byte[] buffer, int bufferPosition)
focal_method.full_signature: @Override public CameraServerData deserialize(byte[] buffer, int bufferPosition)
focal_method.identifier: deserialize
focal_method.invocations: readString length readShort readInt readShort computeIfAbsent getCurrentFile setFileNumber readFrame log
focal_method.modifiers: @Override public
focal_method.parameters: (byte[] buffer, int bufferPosition)
focal_method.return: CameraServerData
focal_method.signature: CameraServerData deserialize(byte[] buffer, int bufferPosition)