test_class.file: sdk/dslink/src/test/java/org/dsa/iot/dslink/util/FileUtilsTest.java
test_class.identifier: FileUtilsTest
test_case.body: @Test
      @SuppressWarnings({"unused", "UnusedAssignment"})
      public void copy() throws IOException {
          File a = File.createTempFile("file-1", "tmp");
          File b = File.createTempFile("file-2", "tmp");
  
          Assert.assertTrue(a.isFile());
          Assert.assertTrue(b.isFile());
  
          try {
              FileUtils.write(a, "Hello world".getBytes("UTF-8"));
              FileUtils.copy(a, b);
  
              byte[] data = FileUtils.readAllBytes(b);
              Assert.assertNotNull(data);
  
              String s = new String(data, "UTF-8");
              Assert.assertEquals("Hello world", s);
          } finally {
              boolean ignored = a.delete();
              ignored = b.delete();
          }
      }
test_case.class_method_signature: FileUtilsTest.copy()
test_case.full_signature: @Test @SuppressWarnings({"unused", "UnusedAssignment"}) public void copy()
test_case.identifier: copy
test_case.invocations: createTempFile createTempFile assertTrue isFile assertTrue isFile write getBytes copy readAllBytes assertNotNull assertEquals delete delete
test_case.modifiers: @Test @SuppressWarnings({"unused", "UnusedAssignment"}) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void copy()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(FileUtils.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(FileUtils.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.file: sdk/dslink/src/main/java/org/dsa/iot/dslink/util/FileUtils.java
focal_class.identifier: FileUtils
focal_class.class_method_signature: FileUtils.readAllBytes(File src)
focal_class.full_signature: public static byte[] readAllBytes(File src)
focal_class.identifier: readAllBytes
focal_class.modifiers: public static
focal_class.parameters: (File src)
focal_class.return: byte[]
focal_class.signature: byte[] readAllBytes(File src)
focal_class.class_method_signature: FileUtils.write(File path, byte[] bytes)
focal_class.full_signature: public static void write(File path, byte[] bytes)
focal_class.identifier: write
focal_class.modifiers: public static
focal_class.parameters: (File path, byte[] bytes)
focal_class.return: void
focal_class.signature: void write(File path, byte[] bytes)
focal_class.class_method_signature: FileUtils.copy(File src, File dest)
focal_class.full_signature: @SuppressFBWarnings("OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE") public static void copy(File src, File dest)
focal_class.identifier: copy
focal_class.modifiers: @SuppressFBWarnings("OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE") public static
focal_class.parameters: (File src, File dest)
focal_class.return: void
focal_class.signature: void copy(File src, File dest)
focal_method.body: @SuppressFBWarnings("OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE")
      public static void copy(File src, File dest) throws IOException {
          if (dest.delete()) {
              LOGGER.debug("Removed " + dest.getPath() + " during copying");
          }
          InputStream input = null;
          FileOutputStream output = null;
  
          try {
              input = new FileInputStream(src);
              output = new FileOutputStream(dest);
  
              byte[] buf = new byte[1024];
              int read;
              while ((read = input.read(buf)) > 0) {
                  output.write(buf, 0, read);
              }
              output.flush();
              try {
                  output.getFD().sync();
              } catch (SyncFailedException ignored) {
              }
          } finally {
              try {
                  if (input != null) {
                      input.close();
                  }
              } catch (IOException e) {
                  if (LOGGER.isDebugEnabled()) {
                      StringWriter writer = new StringWriter();
                      e.printStackTrace(new PrintWriter(writer));
                      LOGGER.debug(writer.toString());
                  }
              }
              try {
                  if (output != null) {
                      output.close();
                  }
              } catch (IOException e) {
                  if (LOGGER.isDebugEnabled()) {
                      StringWriter writer = new StringWriter();
                      e.printStackTrace(new PrintWriter(writer));
                      LOGGER.debug(writer.toString());
                  }
              }
          }
      }
focal_method.class_method_signature: FileUtils.copy(File src, File dest)
focal_method.full_signature: @SuppressFBWarnings("OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE") public static void copy(File src, File dest)
focal_method.identifier: copy
focal_method.invocations: delete debug getPath read write flush sync getFD close isDebugEnabled printStackTrace debug toString close isDebugEnabled printStackTrace debug toString
focal_method.modifiers: @SuppressFBWarnings("OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE") public static
focal_method.parameters: (File src, File dest)
focal_method.return: void
focal_method.signature: void copy(File src, File dest)