Skip to content

MD5#8

Open
Qwsafex wants to merge 18 commits into
masterfrom
MD5
Open

MD5#8
Qwsafex wants to merge 18 commits into
masterfrom
MD5

Conversation

@Qwsafex

@Qwsafex Qwsafex commented Mar 30, 2017

Copy link
Copy Markdown
Owner

No description provided.

@jzuken

jzuken commented Apr 8, 2017

Copy link
Copy Markdown

а чего оно от Lazy растёт, а не от мастера?

import java.util.List;
import java.util.concurrent.RecursiveTask;

class ChecksumTask extends RecursiveTask<byte[]> {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

а где же доки...

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

и тесты, да


public class CLI {
public static void main(String[] args) throws IOException {
for (String path : args) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ну хорошо бы всё же вывести что-то, если пользователь не передал аргументов


@Override
public byte[] calcChecksum(Path path) throws IOException {
InputStream inputStream = Files.newInputStream(path);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

потоки ещё бы и закрывать неплохо

bytesRead = inputStream.read(cache, 0, CACHE_SIZE);
messageDigest.update(cache, 0, bytesRead);
}
return messageDigest.digest(); }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

закрывающая скобка явно не на своём месте


private byte[] calcRecursively(Path path) throws IOException {
if (!Files.isDirectory(path)) {
return new SingleFileChecksumCalculator().calcChecksum(path);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

вот это воистину странное решение, я то думал вы отнаследуетесь от этого класса. а так создавать кучу объектов на ровном месте непонятно зачем


class ChecksumTask extends RecursiveTask<byte[]> {
private static final String MD5 = "MD5";
private static final String NO_SUCH_ALGORITHM_MD5 = "Well, there's no MD5 algorithm in Java...";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

зачем же одни и те же константы по нескольку раз объявлять?

@jzuken

jzuken commented Apr 8, 2017

Copy link
Copy Markdown

6.5 баллов

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.

2 participants