-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve implement for pekko-connectors-text #640
base: main
Are you sure you want to change the base?
Conversation
.Flow[ByteString] | ||
.via(new CharsetDecodingFlow(incoming)) | ||
.asJava | ||
pekko.stream.javadsl.Flow.fromGraph(new CharsetDecodingFlow(incoming)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pekko.stream.javadsl.Flow.fromGraph
will be use the same scaladsl
in the end, this change may break the consistency of code style, you may want to use pekko.stream.scaladsl.Flow.fromGraph(....).asJava
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update by using scaladsl.TextFlow
@@ -44,7 +43,6 @@ object TextFlow { | |||
* Translates a stream of bytes from one character encoding into another. | |||
*/ | |||
def transcoding(incoming: Charset, outgoing: Charset): Flow[ByteString, ByteString, NotUsed] = | |||
Flow[ByteString] | |||
.via(new CharsetTranscodingFlow(incoming, outgoing)) | |||
Flow.fromGraph(new CharsetTranscodingFlow(incoming, outgoing)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you like to take a look? which better?
@@ -14,7 +14,6 @@ | |||
package org.apache.pekko.stream.connectors.text.impl | |||
|
|||
import java.nio.charset.Charset | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better we keep this blank line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep it
pekko.stream.scaladsl | ||
.Flow[ByteString] | ||
.via(new CharsetTranscodingFlow(incoming, outgoing)) | ||
.asJava |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to say, they are same code after all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, I update it
More direct and simple implementation