Skip to content

Commit 8f21268

Browse files
WS-1518: remove guava from rosette-api
1 parent 3cfeb51 commit 8f21268

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

api/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@
6161
<artifactId>httpmime</artifactId>
6262
<version>${http-components-version}</version>
6363
</dependency>
64-
<dependency>
65-
<groupId>com.google.guava</groupId>
66-
<artifactId>guava</artifactId>
67-
<scope>compile</scope>
68-
</dependency>
6964
<dependency>
7065
<groupId>org.slf4j</groupId>
7166
<artifactId>slf4j-api</artifactId>

api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import com.fasterxml.jackson.databind.DeserializationFeature;
3636
import com.fasterxml.jackson.databind.ObjectMapper;
3737
import com.fasterxml.jackson.databind.ObjectWriter;
38-
import com.google.common.io.ByteStreams;
3938
import org.apache.http.Header;
4039
import org.apache.http.HttpEntity;
4140
import org.apache.http.HttpHeaders;
@@ -61,6 +60,7 @@
6160
import org.slf4j.Logger;
6261
import org.slf4j.LoggerFactory;
6362

63+
import java.io.ByteArrayOutputStream;
6464
import java.io.IOException;
6565
import java.io.InputStream;
6666
import java.io.OutputStream;
@@ -159,7 +159,19 @@ private static String getVersion() {
159159
* @throws IOException
160160
*/
161161
private static byte[] getBytes(InputStream is) throws IOException {
162-
return ByteStreams.toByteArray(is);
162+
ByteArrayOutputStream out = new ByteArrayOutputStream();
163+
164+
byte[] buf = new byte[4096];
165+
long total = 0;
166+
167+
while (true) {
168+
int r = is.read(buf);
169+
if (r == -1) {
170+
return out.toByteArray();
171+
}
172+
out.write(buf, 0, r);
173+
total += (long)r;
174+
}
163175
}
164176

165177
private void initClient(String key, List<Header> additionalHeaders) {

0 commit comments

Comments
 (0)