Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

laglangyue
Copy link
Contributor

More direct and simple implementation

.Flow[ByteString]
.via(new CharsetDecodingFlow(incoming))
.asJava
pekko.stream.javadsl.Flow.fromGraph(new CharsetDecodingFlow(incoming))
Copy link
Member

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

https://github.com/apache/pekko/blob/098ab4a298bc5805b9eb851314de88fd0bef4f39/stream/src/main/scala/org/apache/pekko/stream/javadsl/Flow.scala#L78-L82

Copy link
Contributor Author

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))
Copy link
Member

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?

@He-Pin

@@ -14,7 +14,6 @@
package org.apache.pekko.stream.connectors.text.impl

import java.nio.charset.Charset

Copy link
Member

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

Copy link
Contributor Author

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
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, I update it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants