4141import eu .maveniverse .maven .toolbox .shared .ToolboxSearchApi ;
4242import eu .maveniverse .maven .toolbox .shared .output .Output ;
4343import java .io .ByteArrayOutputStream ;
44- import java .io .FileInputStream ;
4544import java .io .IOException ;
4645import java .io .InputStream ;
4746import java .nio .charset .StandardCharsets ;
4847import java .nio .file .Files ;
4948import java .nio .file .Path ;
50- import java .nio .file .Paths ;
5149import java .security .MessageDigest ;
5250import java .security .NoSuchAlgorithmException ;
5351import java .text .CharacterIterator ;
@@ -632,10 +630,9 @@ public Result<Path> localRepository() throws Exception {
632630 public Result <Path > artifactPath (Artifact artifact , RemoteRepository repository ) throws Exception {
633631 Result <Path > result ;
634632 if (repository == null ) {
635- result =
636- Result .success (Paths .get (session .getLocalRepositoryManager ().getPathForLocalArtifact (artifact )));
633+ result = Result .success (Path .of (session .getLocalRepositoryManager ().getPathForLocalArtifact (artifact )));
637634 } else {
638- result = Result .success (Paths . get (
635+ result = Result .success (Path . of (
639636 session .getLocalRepositoryManager ().getPathForRemoteArtifact (artifact , repository , "toolbox" )));
640637 }
641638 result .getData ().ifPresent (path -> output .tell (path .toString ()));
@@ -646,10 +643,9 @@ public Result<Path> artifactPath(Artifact artifact, RemoteRepository repository)
646643 public Result <Path > metadataPath (Metadata metadata , RemoteRepository repository ) throws Exception {
647644 Result <Path > result ;
648645 if (repository == null ) {
649- result =
650- Result .success (Paths .get (session .getLocalRepositoryManager ().getPathForLocalMetadata (metadata )));
646+ result = Result .success (Path .of (session .getLocalRepositoryManager ().getPathForLocalMetadata (metadata )));
651647 } else {
652- result = Result .success (Paths . get (
648+ result = Result .success (Path . of (
653649 session .getLocalRepositoryManager ().getPathForRemoteMetadata (metadata , repository , "toolbox" )));
654650 }
655651 result .getData ().ifPresent (path -> output .tell (path .toString ()));
@@ -1084,13 +1080,13 @@ public Result<Map<String, Artifact>> identify(
10841080 RemoteRepository remoteRepository , Collection <String > targets , boolean decorated ) throws IOException {
10851081 HashMap <String , String > sha1s = new HashMap <>();
10861082 for (String target : targets ) {
1087- if (Files .exists (Paths . get (target ))) {
1083+ if (Files .exists (Path . of (target ))) {
10881084 try {
10891085 output .tell ("Calculating SHA1 of file {}" , target );
10901086 MessageDigest sha1md = MessageDigest .getInstance ("SHA-1" );
10911087 byte [] buf = new byte [8192 ];
10921088 int read ;
1093- try (FileInputStream fis = new FileInputStream ( target )) {
1089+ try (InputStream fis = Files . newInputStream ( Path . of ( target ) )) {
10941090 read = fis .read (buf );
10951091 while (read != -1 ) {
10961092 sha1md .update (buf , 0 , read );
0 commit comments