priyamtejaswin commented on PR #117:
URL:
https://github.com/apache/datasketches-website/pull/117#issuecomment-1150205080
Hi Lee,
> Could you give us some examples of how you would use the IO calls?
Sure. My IDE was troubling me to handle IO exceptions. So for
`FileOutputStream`, instead of
```java
UpdateSketch sketch1 = UpdateSketch.builder().build();
for (int key = 0; key < 100000; key++) sketch1.update(key);
FileOutputStream out1 = new FileOutputStream("/path/ThetaSketch1.bin",
false);
out1.write(sketch1.compact().toByteArray());
out1.close();
```
I had to rewrite it as
```java
UpdateSketch sketch1 = UpdateSketch.builder().build();
for (int key = 0; key < 100000; key++) sketch1.update(key);
try {
FileOutputStream out1 = new
FileOutputStream("/path/ThetaSketch1.bin", false);
try {
out1.write(sketch1.compact().toByteArray());
out1.close();
} catch (IOException ioe) {
System.out.println(ioe.getMessage());
}
} catch (FileNotFoundException fnfe) {
System.out.println(fnfe.getMessage());
}
```
It's possible this is a IDE specific thing (I develop and test using
Intellij).
> Are you talking about the example code? If so, the example code is
simplified by design to eliminate a lot of boilerplate code.
Yes. I was talking about the example code specifically.
Ah yes I guessed the example was simplified to keep the boilerplate out of
the way.
I think it suffices.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]