You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/11/25 06:05:57 UTC

[GitHub] [camel] davsclaus commented on a change in pull request #6473: CAMEL-17229: optimisation to create files from a String

davsclaus commented on a change in pull request #6473:
URL: https://github.com/apache/camel/pull/6473#discussion_r756593583



##########
File path: components/camel-file/src/main/java/org/apache/camel/component/file/FileOperations.java
##########
@@ -408,6 +411,16 @@ public boolean storeFile(String fileName, Exchange exchange, long size) throws G
         }
     }
 
+    private void writeFileFromString(String body, File target) throws IOException {

Review comment:
       Can you rename to `writeFileByString` and move the method down to where the others are

##########
File path: components/camel-file/src/main/java/org/apache/camel/component/file/FileOperations.java
##########
@@ -381,6 +381,9 @@ public boolean storeFile(String fileName, Exchange exchange, long size) throws G
                 // buffer the reader
                 in = IOHelper.buffered(in);
                 writeFileByReaderWithCharset(in, file, charset);
+            } else if (exchange.getIn().getBody() instanceof String &&
+                    ((String) exchange.getIn().getBody()).length() < endpoint.getBufferSize()) {

Review comment:
       Maybe put the body into a String str = (String) ... so you avoid the ugly type casts




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org