Ignore:
Timestamp:
2016-03-14T22:15:51+01:00 (10 years ago)
Author:
bastiK
Message:

fixed #12264 - Add own CA's to Java cert-store

Location:
trunk/src/org/openstreetmap/josm/io
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/CachedFile.java

    r9977 r9995  
    66import java.io.BufferedInputStream;
    77import java.io.BufferedReader;
     8import java.io.ByteArrayOutputStream;
    89import java.io.Closeable;
    910import java.io.File;
     
    213214
    214215    /**
     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    /**
    215234     * Returns {@link #getInputStream()} wrapped in a buffered reader.
    216235     * <p>
Note: See TracChangeset for help on using the changeset viewer.