Package java.io

Examples of java.io.ByteArrayOutputStream.reset()


                    int low = (toEncode & 0x0f);
                    int high = ((toEncode & 0xf0) >> 4);
                    rewrittenPath.append(hexadecimal[high]);
                    rewrittenPath.append(hexadecimal[low]);
                }
                buf.reset();
            }
        }
        return rewrittenPath.toString();
    }
}
View Full Code Here


      throws IOException
   {
      byte[] buffer = new byte[ 8192 ];
      ByteArrayOutputStream baos = new ByteArrayOutputStream( 2048 );
      int n;
      baos.reset();
      try
      {
         while((n = is.read(buffer, 0, buffer.length)) != -1)
            baos.write(buffer, 0, n);
         buffer = baos.toByteArray();
View Full Code Here

                dos.write(uncompressed, index, length);
                dos.flush();
                baos.flush();

                byte compressed[] = baos.toByteArray();
                baos.reset();
                if (compressed.length > 0)
                {
                    // Debug.debug("compressed", compressed.length);
                    writeChunkIDAT(os, compressed);
                }
View Full Code Here

         {
            String aname = (String) e.nextElement();
            Object so = get(aname);
            if (so instanceof Serializable)
            {
               os.reset();
               ObjectOutputStream oos = new ObjectOutputStream(os);
               try
               {
                  oos.writeObject(so);
                  w.write(aname);
View Full Code Here

        byte[] replacement;
        int bb;
        final ByteBuffer structure = new ByteBuffer();
        while (transferUntil(pis, out, hashChar)) {
            bb = pis.read();
            keyStream.reset();

            // #{
            if ((bb & 0xFF) == lcbr) { //multi
                if (transferUntil(pis, keyStream, mClose)) { //close tag
                    //multi_key =  "_" + keyStream.toString(); //for _Key
View Full Code Here

                    bb = pis.read();
                    if ((bb & 0xFF) != 10){ //kill newline
                        pis.unread(bb);
                    }
                    multi_key = keyStream.toByteArray(); //IMPORTANT: no prefix here
                    keyStream.reset(); //reset stream

                    //this needs multi_key without prefix
                    if (transferUntil(pis, keyStream, appendBytes(mOpen, slashChar, multi_key, mClose))){
                        bb = pis.read();
                        if((bb & 0xFF) != 10){ //kill newline
View Full Code Here

                final ByteBuffer text= new ByteBuffer();

                transferUntil(pis, keyStream, aClose);
                key = keyStream.toByteArray(); //Caution: Key does not contain prefix

                keyStream.reset(); //clear

                boolean byName=false;
                int whichPattern=0;
                byte[] patternName = new byte[0];
                final String patternKey = getPatternKey(prefix, key);
View Full Code Here

                    }
                }

                int currentPattern=0;
                boolean found=false;
                keyStream.reset(); //reset stream
                PushbackInputStream pis2;
                if (byName) {
                    //TODO: better Error Handling
                    transferUntil(pis, keyStream, appendBytes(PP, patternName, null, null));
                    if(pis.available()==0){
View Full Code Here

                    transferUntil(pis, keyStream, appendBytes(PP, patternName, null, null));
                    if(pis.available()==0){
                        Log.logSevere("TEMPLATE", "No such Template: %%" + UTF8.String(patternName));
                        return structure.getBytes();
                    }
                    keyStream.reset();
                    transferUntil(pis, keyStream, dpdpa);
                    pis2 = new PushbackInputStream(new ByteArrayInputStream(keyStream.toByteArray()));
                    structure.append(writeTemplate(pis2, out, pattern, dflt, newPrefix(prefix,key)));
                    transferUntil(pis, keyStream, appendBytes(hash_brackopen_slash, key, brackclose_hash, null));
                    if(pis.available()==0){
View Full Code Here

                                    text.append(aOpen).append(keyStream.toByteArray()).append(brackclose_hash);
                                } else { //nested
                                    others++;
                                    text.append(aOpen).append(keyStream.toByteArray()).append(brackclose_hash);
                                }
                                keyStream.reset(); //reset stream
                                continue;
                            } //is not #(
                            pis.unread(bb);//is processed in next loop
                            bb = (hashChar);//will be added to text this loop
                            //text += "#";
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.