test_class.declarator: csvDetector
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private CSVDetector csvDetector;
test_class.type: CSVDetector
test_class.var_name: csvDetector
test_class.file: dataprep-backend-service/src/test/java/org/talend/dataprep/schema/csv/CSVDetectorTest.java
test_class.identifier: CSVDetectorTest
test_class.superclass: extends AbstractSchemaTestUtils
test_case.body: @Test
      public void should_detect_CSV_format_and_encoding() throws IOException {
          try (InputStream inputStream = this.getClass().getResourceAsStream("standard.csv")) {
              Format actual = csvDetector.detect(inputStream);
  
              Assert.assertNotNull(actual);
              assertTrue(actual.getFormatFamily() instanceof CSVFormatFamily);
              assertEquals("ISO-8859-1", actual.getEncoding());
  
          }
      }
test_case.class_method_signature: CSVDetectorTest.should_detect_CSV_format_and_encoding()
test_case.full_signature: @Test public void should_detect_CSV_format_and_encoding()
test_case.identifier: should_detect_CSV_format_and_encoding
test_case.invocations: getResourceAsStream getClass detect assertNotNull assertTrue getFormatFamily assertEquals getEncoding
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void should_detect_CSV_format_and_encoding()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(CSVDetector.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(CSVDetector.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: TEXT_PLAIN = "text/plain"
focal_class.modifier: private static final
focal_class.original_string: private static final String TEXT_PLAIN = "text/plain";
focal_class.type: String
focal_class.var_name: TEXT_PLAIN
focal_class.declarator: mimeTypes = MimeTypes.getDefaultMimeTypes()
focal_class.modifier: private final
focal_class.original_string: private final MimeTypes mimeTypes = MimeTypes.getDefaultMimeTypes();
focal_class.type: MimeTypes
focal_class.var_name: mimeTypes
focal_class.declarator: encodingDetector = new UniversalEncodingDetector()
focal_class.modifier: private final
focal_class.original_string: private final UniversalEncodingDetector encodingDetector = new UniversalEncodingDetector();
focal_class.type: UniversalEncodingDetector
focal_class.var_name: encodingDetector
focal_class.declarator: csvFormatFamily
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private CSVFormatFamily csvFormatFamily;
focal_class.type: CSVFormatFamily
focal_class.var_name: csvFormatFamily
focal_class.file: dataprep-backend-service/src/main/java/org/talend/dataprep/schema/csv/CSVDetector.java
focal_class.identifier: CSVDetector
focal_class.interfaces: implements Detector
focal_class.class_method_signature: CSVDetector.detect(Metadata metadata, TikaInputStream inputStream)
focal_class.full_signature: @Override public Format detect(Metadata metadata, TikaInputStream inputStream)
focal_class.identifier: detect
focal_class.modifiers: @Override public
focal_class.parameters: (Metadata metadata, TikaInputStream inputStream)
focal_class.return: Format
focal_class.signature: Format detect(Metadata metadata, TikaInputStream inputStream)
focal_class.class_method_signature: CSVDetector.detectText(Metadata metadata, InputStream inputStream)
focal_class.full_signature: private Format detectText(Metadata metadata, InputStream inputStream)
focal_class.identifier: detectText
focal_class.modifiers: private
focal_class.parameters: (Metadata metadata, InputStream inputStream)
focal_class.return: Format
focal_class.signature: Format detectText(Metadata metadata, InputStream inputStream)
focal_method.body: @Override
      public Format detect(Metadata metadata, TikaInputStream inputStream) throws IOException {
  
          Format result = detectText(metadata, inputStream);
  
          if (result == null) {
              inputStream.mark(FormatUtils.META_TAG_BUFFER_SIZE);
              byte[] buffer = new byte[FormatUtils.META_TAG_BUFFER_SIZE];
              int n = 0;
  
              for (int m = inputStream.read(buffer); m != -1 && n < buffer.length; m =
                      inputStream.read(buffer, n, buffer.length - n)) {
                  n += m;
              }
  
              inputStream.reset();
              String head = FormatUtils.readFromBuffer(buffer, 0, n);
  
              try (InputStream stream = TikaInputStream.get(IOUtils.toInputStream(head))) {
                  result = detectText(new Metadata(), stream);
              }
          }
          return result;
      }
focal_method.class_method_signature: CSVDetector.detect(Metadata metadata, TikaInputStream inputStream)
focal_method.full_signature: @Override public Format detect(Metadata metadata, TikaInputStream inputStream)
focal_method.identifier: detect
focal_method.invocations: detectText mark read read reset readFromBuffer get toInputStream detectText
focal_method.modifiers: @Override public
focal_method.parameters: (Metadata metadata, TikaInputStream inputStream)
focal_method.return: Format
focal_method.signature: Format detect(Metadata metadata, TikaInputStream inputStream)