Skip to content
Open

good #350

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions task01/src/com/example/task01/Task01Main.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
package com.example.task01;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;

public class Task01Main {
public static void main(String[] args) throws IOException, InterruptedException {
//здесь вы можете вручную протестировать ваше решение, вызывая реализуемый метод и смотря результат
// например вот так:

/*
System.out.println(extractSoundName(new File("task01/src/main/resources/3727.mp3")));
*/
}

public static String extractSoundName(File file) throws IOException, InterruptedException {
// your implementation here
return "sound name";
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command("cmd.exe", "/c", "ffmpeg -i \"" + file.getAbsolutePath() + "\"")
.redirectErrorStream(true);
Process process = processBuilder.start();

try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
String line;
while ((line = bufferedReader.readLine()) != null) {
if (line.contains("title")) {
return line.split(": ", 2)[1].trim();
}
}
}
return null;
}
}
Binary file added task01/src/main/resources/ffmpeg-7.1.tar.xz
Binary file not shown.
13 changes: 8 additions & 5 deletions task02/src/com/example/task02/Task02Main.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
package com.example.task02;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.stream.Collectors;

public class Task02Main {
public static void main(String[] args) throws IOException, InterruptedException {
//здесь вы можете вручную протестировать ваше решение, вызывая реализуемый метод и смотря результат
// например вот так:

/*

System.out.println(listFiles(Paths.get("task02/src/main/resources/")));
*/


}

public static List<Path> listFiles(Path rootDir) throws IOException, InterruptedException {
// your implementation here

return null;
return Files.walk(rootDir)
.filter(x->x.toFile().isFile())
.collect(Collectors.toList());
}
}
5 changes: 3 additions & 2 deletions task03/src/com/example/task03/SampleData.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.example.task03;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

public class SampleData {
public class SampleData implements Serializable {
static final long serialVersionUID = 132706691457162967L;

String name;
Expand Down Expand Up @@ -39,4 +40,4 @@ public String toString() {
", date=" + date +
'}';
}
}
}
9 changes: 5 additions & 4 deletions task03/src/com/example/task03/Task03Main.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.example.task03;

import java.io.IOException;
import java.io.InputStream;

import java.io.ObjectInputStream;
public class Task03Main {
public static void main(String[] args) throws IOException, ClassNotFoundException {
//здесь вы можете вручную протестировать ваше решение, вызывая реализуемый метод и смотря результат
Expand All @@ -15,7 +14,9 @@ public static void main(String[] args) throws IOException, ClassNotFoundExceptio
}

public static SampleData deserialize(InputStream inputStream) throws IOException, ClassNotFoundException {
// your implementation here
return null;
try (ObjectInputStream obj = new ObjectInputStream(inputStream))
{
return (SampleData) obj.readObject();
}
}
}