File tree Expand file tree Collapse file tree 3 files changed +14
-8
lines changed
src/main/java/com/basistech/rosette/api
examples/src/main/java/com/basistech/rosette/examples Expand file tree Collapse file tree 3 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 3535import com .fasterxml .jackson .databind .DeserializationFeature ;
3636import com .fasterxml .jackson .databind .ObjectMapper ;
3737import com .fasterxml .jackson .databind .ObjectWriter ;
38- import com .google .common .io .ByteStreams ;
3938import org .apache .http .Header ;
4039import org .apache .http .HttpEntity ;
4140import org .apache .http .HttpHeaders ;
6160import org .slf4j .Logger ;
6261import org .slf4j .LoggerFactory ;
6362
63+ import java .io .ByteArrayOutputStream ;
6464import java .io .IOException ;
6565import java .io .InputStream ;
6666import java .io .OutputStream ;
@@ -159,7 +159,18 @@ 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+
166+ while (true ) {
167+ int r = is .read (buf );
168+ if (r == -1 ) {
169+ out .flush ();
170+ return out .toByteArray ();
171+ }
172+ out .write (buf , 0 , r );
173+ }
163174 }
164175
165176 private void initClient (String key , List <Header > additionalHeaders ) {
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ public static void main(String[] args) {
3939 }
4040
4141 private void run () throws IOException {
42- String categoriesUrlData = "http ://www. onlocationvacations.com/2015/03/05/the-new-ghostbusters-movie-begins-filming-in-boston-in-june/" ;
42+ String categoriesUrlData = "https ://onlocationvacations.com/2015/03/05/the-new-ghostbusters-movie-begins-filming-in-boston-in-june/" ;
4343 HttpRosetteAPI rosetteApi = new HttpRosetteAPI .Builder ()
4444 .key (getApiKeyFromSystemProperty ())
4545 .url (getAltUrlFromSystemProperty ())
You can’t perform that action at this time.
0 commit comments