Skip to content

Commit

Permalink
Merge pull request #101 from iipc/remove-fastutils
Browse files Browse the repository at this point in the history
Remove dependency on fastutil
  • Loading branch information
ato authored Dec 4, 2024
2 parents 8988fbb + 328aef2 commit 5022a67
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 11 deletions.
5 changes: 0 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,6 @@
<artifactId>libidn</artifactId>
<version>1.15</version>
</dependency>
<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
<version>7.0.10</version>
</dependency>

<!-- explicitly require a patched commons-collections to avoid vulnerable v3.2.1 -->
<dependency>
Expand Down
42 changes: 42 additions & 0 deletions src/main/java/it/unimi/dsi/fastutil/io/RepositionableStream.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// copied from fastutil, keeping the original package name to avoid breaking
// compatibility with existing user code that implements this interface
package it.unimi.dsi.fastutil.io;

/*
* Copyright (C) 2005-2015 Sebastiano Vigna
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


/** A basic interface specifying positioning methods for a byte stream.
*
* @author Sebastiano Vigna
* @since 4.4
*/

public interface RepositionableStream {

/** Sets the current stream position.
*
* @param newPosition the new stream position.
*/
void position( long newPosition ) throws java.io.IOException;

/** Returns the current stream position.
*
* @return the current stream position.
*/
long position() throws java.io.IOException;

}
5 changes: 2 additions & 3 deletions src/main/java/org/archive/io/RecordingOutputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

package org.archive.io;

import it.unimi.dsi.fastutil.io.FastBufferedOutputStream;

import java.io.BufferedOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
Expand Down Expand Up @@ -207,7 +206,7 @@ public void open(OutputStream wrappedStream) throws IOException {
protected OutputStream ensureDiskStream() throws FileNotFoundException {
if (this.diskStream == null) {
FileOutputStream fis = new FileOutputStream(this.backingFilename);
this.diskStream = new FastBufferedOutputStream(fis);
this.diskStream = new BufferedOutputStream(fis);
}
return this.diskStream;
}
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/archive/io/WriterPoolMember.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

package org.archive.io;

import it.unimi.dsi.fastutil.io.FastBufferedOutputStream;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
Expand Down Expand Up @@ -200,7 +199,7 @@ protected String createFile(final File file) throws IOException {
close();
this.f = file;
FileOutputStream fos = new FileOutputStream(this.f);
this.countOut = new MiserOutputStream(new FastBufferedOutputStream(fos),settings.getFrequentFlushes());
this.countOut = new MiserOutputStream(new BufferedOutputStream(fos),settings.getFrequentFlushes());
this.out = this.countOut;
logger.fine("Opened " + this.f.getAbsolutePath());
return this.f.getName();
Expand Down

0 comments on commit 5022a67

Please sign in to comment.