Skip to content

Passio Practice Exercise implemented - #2970

Open
shreyasgosavi wants to merge 2 commits into
exercism:mainfrom
shreyasgosavi:main
Open

shreyasgosavi wants to merge 2 commits into
exercism:mainfrom
shreyasgosavi:main

Conversation

@shreyasgosavi

Copy link
Copy Markdown
Contributor

pull request

Hello, raising PR for paasio exercise implementation. Issue ID : #1813


Reviewer Resources:

Track Policies

@shreyasgosavi
shreyasgosavi marked this pull request as draft July 5, 2025 05:17
@kahgoh kahgoh changed the title Passi Practice Exercise implemented Passio Practice Exercise implemented Jul 5, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This file should just contain enough of the stub for students to start. Have a look at the stub for the Poker for example. It only contains the bare methods for students to fill.

When the student starts the Paasio exercise, the student will start with the contents of this file. They should not start with the solution.

Comment thread config.json Resolved
@shreyasgosavi

Copy link
Copy Markdown
Contributor Author

Thanks for time and that's really good explanation will do it 🤘

@shreyasgosavi
shreyasgosavi marked this pull request as ready for review August 5, 2025 19:58
@shreyasgosavi

Copy link
Copy Markdown
Contributor Author

Heyyy I have made the requested changes could you please verify that

Comment thread config.json Resolved
@Disabled("Remove to run test")
void checkByteValueReadFromTheFile() throws IOException {

byte[] fileData = new byte[100];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this fileData name came from an earlier iteration where we had a distinction between file and network data. However, we no longer have this distinction, so I'd suggest renaming it. Perhaps just data?

@Disabled("Remove to run test")
void verifyBytesWrittenFromOffsetIntoTheOutputStreamAlongWithTheCount() throws IOException {

String fileContentToBeWritten = " This is additional Content.";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Similar to another comment, this isn't "file" specific, so suggest renaming the variable.

@IsaacG

IsaacG commented Sep 27, 2026

Copy link
Copy Markdown
Member

@shreyasgosavi Are you still interested in making this happen or should we close this out as abandoned?

@kahgoh

kahgoh commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

Closing this PR due to lack of activity. Happy to re-open would like to continue this one.

@kahgoh kahgoh closed this Oct 10, 2026
@shreyasgosavi

shreyasgosavi commented Oct 10, 2026 via email

Copy link
Copy Markdown
Contributor Author

@kahgoh kahgoh reopened this Oct 10, 2026
@kahgoh

kahgoh commented Oct 10, 2026

Copy link
Copy Markdown
Member

Re-opening for @shreyasgosavi

@shreyasgosavi

shreyasgosavi commented Oct 10, 2026 via email

Copy link
Copy Markdown
Contributor Author

@kahgoh

kahgoh commented Nov 13, 2026

Copy link
Copy Markdown
Member

Hi @shreyasgosavi, are you still working on this one?

@shreyasgosavi

shreyasgosavi commented Nov 14, 2026 via email

Copy link
Copy Markdown
Contributor Author

@IsaacG

IsaacG commented Nov 21, 2026

Copy link
Copy Markdown
Member

@shreyasgosavi Any updates here? Any idea when you can get this done?

@shreyasgosavi

shreyasgosavi commented Nov 21, 2026 via email

Copy link
Copy Markdown
Contributor Author

@shreyasgosavi shreyasgosavi reopened this Nov 23, 2026
@shreyasgosavi

Copy link
Copy Markdown
Contributor Author

hey working on the changes

@shreyasgosavi

Copy link
Copy Markdown
Contributor Author

What to do for i18 check?

@kahgoh

kahgoh commented Nov 25, 2026

Copy link
Copy Markdown
Member

What to do for i18 check?

You don't have to do anything for that - I'll take care of it later, prior to merging.

@@ -0,0 +1,17 @@
{
"authors": [],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Feel free to add yourself as the author

Comment on lines +16 to +22
public InputStream getInputStream() {
return inputStream;
}

public OutputStream getOutputStream() {
return outputStream;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we can remove these getInputStream and getOutputStream methods. They don't seem to be used.

}

@Test
void checkAmountOfDataReadInBytesForMultipleOperations() throws IOException {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Missing a @Disabled here.

Suggested change
void checkAmountOfDataReadInBytesForMultipleOperations() throws IOException {
@Disabled("Remove to run test")
void checkAmountOfDataReadInBytesForMultipleOperations() throws IOException {

Comment on lines +8 to +14
private long bytesRead;
private long readOperationCount;
private long bytesWritten;
private long writeOperationCount;

private final InputStream inputStream;
private final OutputStream outputStream;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the fields could be removed from the stub. Students can decide which fields are needed.

Suggested change
private long bytesRead;
private long readOperationCount;
private long bytesWritten;
private long writeOperationCount;
private final InputStream inputStream;
private final OutputStream outputStream;

Comment on lines +77 to +91
public long getBytesRead() {
return bytesRead;
}

public long getReadOperationCount() {
return readOperationCount;
}

public long getBytesWritten() {
return bytesWritten;
}

public long getWriteOperationCount() {
return writeOperationCount;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These methods should just throw UnsupportedOperationException - let students fill these methods.

return outputStream;
}

public Paasio(InputStream inputStream, OutputStream outputStream) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I just noticed most of the reference solution looks like the methods wrap they around the InputStream and OutputStream methods. I was thinking if we want to give students a bit more to work with, we could pass a byte arrays (byte []) instead (the byte arrays would represent data buffers where data will be read or written to). They would still be able to create InputStream and OutputStream around that, but I think they could also choose to work with the byte[] instead.

Take this as a suggestion though - happy to stick with InputStream and OutputStream approach

@shreyasgosavi shreyasgosavi Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yea had same idea of that earlier, but thought it might complicate (for exercise point-of-view) as there are multiple ways to use single function in IO Streams.

Eg:
read() method has 2 ways of usage -- read one-byte and to read the data into byte-array (public int read() & public int read(byte[] b) ), so thought of going with that approach.

But if you have any other idea, we can go with it ✌️

Comment on lines +96 to +97
String dataInFile = new String(messageArray, 0, initialMessage.length + bytesRead, StandardCharsets.UTF_8);
assertThat(dataInFile).isEqualTo("Hello! This is data ");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove inFile reference

Suggested change
String dataInFile = new String(messageArray, 0, initialMessage.length + bytesRead, StandardCharsets.UTF_8);
assertThat(dataInFile).isEqualTo("Hello! This is data ");
String data = new String(messageArray, 0, initialMessage.length + bytesRead, StandardCharsets.UTF_8);
assertThat(data ).isEqualTo("Hello! This is data ");

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.

4 participants