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



##########
File path: core/camel-api/src/main/java/org/apache/camel/Resumable.java
##########
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel;
+
+public interface Resumable<T> {

Review comment:
       Add javadoc to this API.

##########
File path: core/camel-util/src/main/java/org/apache/camel/util/IOHelper.java
##########
@@ -116,11 +118,22 @@ public static BufferedWriter buffered(Writer writer) {
     }
 
     public static String toString(Reader reader) throws IOException {
-        return toString(buffered(reader));
+        return toString(reader, INITIAL_OFFSET);
+    }
+
+    public static String toString(Reader reader, long offset) throws 
IOException {
+        return toString(buffered(reader), offset);
     }
 
     public static String toString(BufferedReader reader) throws IOException {
+        return toString(reader, INITIAL_OFFSET);
+    }
+
+    public static String toString(BufferedReader reader, long offset) throws 
IOException {
         StringBuilder sb = new StringBuilder(1024);
+
+        reader.skip(offset);

Review comment:
       I wonder if its safer to only skip if offset > 0

##########
File path: 
components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileConverter.java
##########
@@ -183,13 +185,17 @@ public static Reader genericFileToReader(GenericFile<?> 
file, Exchange exchange)
             // and use the charset if the file was explicit configured with a
             // charset
             String charset = file.getCharset();
+            Reader reader;
             if (charset != null) {
                 LOG.debug("Read file {} with charset {}", f, 
file.getCharset());
-                return IOHelper.toReader(f, charset);
+                reader = IOHelper.toReader(f, charset);
             } else {
                 LOG.debug("Read file {} (no charset)", f);
-                return IOHelper.toReader(f, 
ExchangeHelper.getCharsetName(exchange));
+                reader = IOHelper.toReader(f, 
ExchangeHelper.getCharsetName(exchange));
             }
+
+            reader.skip(file.getLastOffset());

Review comment:
       I wonder if its safer to only skip if offset > 0




-- 
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-unsubscr...@camel.apache.org

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


Reply via email to