Changeset 9995 in josm for trunk/src/org/openstreetmap/josm/io
- Timestamp:
- 2016-03-14T22:15:51+01:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/io
- Files:
-
- 1 added
- 1 edited
-
CachedFile.java (modified) (2 diffs)
-
CertificateAmendment.java (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/CachedFile.java
r9977 r9995 6 6 import java.io.BufferedInputStream; 7 7 import java.io.BufferedReader; 8 import java.io.ByteArrayOutputStream; 8 9 import java.io.Closeable; 9 10 import java.io.File; … … 213 214 214 215 /** 216 * Get the full content of the requested resource as a byte array. 217 * @return the full content of the requested resource as byte array 218 * @throws IOException in case of an I/O error 219 */ 220 public byte[] getByteContent() throws IOException { 221 try (InputStream is = getInputStream()) { 222 ByteArrayOutputStream buffer = new ByteArrayOutputStream(); 223 int nRead; 224 byte[] data = new byte[8192]; 225 while ((nRead = is.read(data, 0, data.length)) != -1) { 226 buffer.write(data, 0, nRead); 227 } 228 buffer.flush(); 229 return buffer.toByteArray(); 230 } 231 } 232 233 /** 215 234 * Returns {@link #getInputStream()} wrapped in a buffered reader. 216 235 * <p>
Note:
See TracChangeset
for help on using the changeset viewer.
