Package java.io

Examples of java.io.BufferedInputStream.available()


        }
        // put file into buffer
        bis = new BufferedInputStream(fis);
        bos = new BufferedOutputStream(fos);
        try { // read file, write and close
            b = new byte[bis.available()];
            bis.read(b);
            bos.write(b);
            bis.close();
            bos.close();
            file_copied = true;
View Full Code Here


    private void testFailed() {
        ++numErrors;

        try {
            InputStream input = new BufferedInputStream(new FileInputStream(outputFile));
            int length = input.available();
            byte[] b = new byte[length];
            input.read(b, 0, length);
            writeTestProblems(testName, new String(b));
        }
        catch (IOException e) {
View Full Code Here

    public static byte[] getBytesFromResource( String resource ) throws IOException
    {
        InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream( resource );

        BufferedInputStream stream = new BufferedInputStream( is );
        int len = stream.available();
        byte[] bytes = new byte[len];
        stream.read( bytes, 0, len );

        return bytes;
    }
View Full Code Here

    private void testFailed() {
        ++numErrors;

        try {
            InputStream input = new BufferedInputStream(new FileInputStream(outputFile));
            int length = input.available();
            byte[] b = new byte[length];
            input.read(b, 0, length);
            writeTestProblems(testName, new String(b));
        }
        catch (IOException e) {
View Full Code Here

            while (i.hasNext()) {
                final String imageName = i.next();
                final ZipEntry zipEntry = zipFile.getEntry(imageName);

                final BufferedInputStream bufferedInputStream = new BufferedInputStream(zipFile.getInputStream(zipEntry));
                final byte[] captchaCharData = new byte[bufferedInputStream.available()];
                bufferedInputStream.read(captchaCharData);
                bufferedInputStream.close();

                final Image captchaChar = imageService.makeImage(captchaCharData);
View Full Code Here

        }
        // put file into buffer
        bis = new BufferedInputStream(fis);
        bos = new BufferedOutputStream(fos);
        try { // read file, write and close
            b = new byte[bis.available()];
            bis.read(b);
            bos.write(b);
            bis.close();
            bos.close();
            file_copied = true;
View Full Code Here

    private void testFailed() {
        ++numErrors;

        try {
            InputStream input = new BufferedInputStream(new FileInputStream(outputFile));
            int length = input.available();
            byte[] b = new byte[length];
            input.read(b, 0, length);
            writeTestProblems(testName, new String(b));
        }
        catch (IOException e) {
View Full Code Here

            // do nothing
        }
        if ( fileType==null ) {
            try {// read concatenated certificate in PEM format
                final BufferedInputStream bis = new BufferedInputStream(new FileInputStream(fileName));
                while (bis.available() > 0) {
                    if ( putSignEntityCard(cf.generateCertificate(bis), adm, newSignEntity) ) {
                        fileType="PEM";
                    }
                }
            } catch(Exception e){
View Full Code Here

     * @return
     */
    protected byte[] loadCert(String arg) {
    try {
      BufferedInputStream bis = new BufferedInputStream(new FileInputStream(arg));
      byte[] retval = new byte[bis.available()];
      bis.read(retval);
      return retval;
     
    } catch (FileNotFoundException e) {
      getPrintStream().println("Couldn't find file with name " + arg);
View Full Code Here

                // stop reading, so we cannot block
                // TODO propery implement support for chunked transfer, i.e. to
                // know when we have read the whole request, and therefore allow
                // the reading to block
                log.debug("Chunked");
                while(in.available() > 0 && ((length = in.read(buffer)) != -1)) {
                    out.write(buffer, 0, length);
                }
            }
            else {
                // The reqest has no body, or it has a transfer encoding we do not support.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.