Examples of FastByteArrayOutputStream


Examples of com.cloudhopper.commons.util.FastByteArrayOutputStream

            return null;
        }

        // estimate the length of the dynamic byte array
        int estimatedByteLength = estimateEncodeByteLength(str0);
        FastByteArrayOutputStream baos = new FastByteArrayOutputStream(estimatedByteLength);

        try {
            int len = str0.length();
            for (int i = 0; i < len; i++) {
                int search = 0;
                char c = str0.charAt(i);
                for (; search < CHAR_TABLE.length; search++) {
                    if (search == EXTENDED_ESCAPE) {
                        continue;
                    }

                    if (c == CHAR_TABLE[search]) {
                        baos.write(search);
                        break;
                    }

                    if (c == EXT_CHAR_TABLE[search]) {
                        baos.write(EXTENDED_ESCAPE);
                        baos.write(search);
                        break;
                    }
                }
                if (search == CHAR_TABLE.length) {
                    // A '?' character.
                    baos.write(0x3f);
                }
            }
        } catch (IOException e) {
            // should be an impossible error
            throw new RuntimeException("Impossible error with FastByteArrayOutputStream: " + e.getMessage(), e);
        }

        return baos.toByteArray();

    }
View Full Code Here

Examples of com.opensymphony.module.sitemesh.util.FastByteArrayOutputStream

    public ServletOutputStream getOutputStream() {
        if (bufferedStream == null) {
            if (bufferedWriter != null) {
                throw new IllegalStateException("response.getOutputStream() called after response.getWriter()");
            }
            bufferedStream = new FastByteArrayOutputStream();
            exposedStream = new ServletOutputStream() {
                public void write(int b) {
                    bufferedStream.write(b);
                }
            };
View Full Code Here

Examples of it.unimi.dsi.fastutil.io.FastByteArrayOutputStream

      this.batchDir = batchDir;
      this.cutPoints = new IntArrayList();
      this.cutPoints.add( 0 );

      flags = new EnumMap<Component, Coding>( CompressionFlags.DEFAULT_PAYLOAD_INDEX );
      accumulatorStream = new FastByteArrayOutputStream();
      accumulator = new OutputBitStream( accumulatorStream );
    }
View Full Code Here

Examples of it.unimi.dsi.fastutil.io.FastByteArrayOutputStream

    cachePositionsLength = new long[ two2h + 1 ];
    cachePointer = new OutputBitStream[ two2h ];
    cachePointerByte = new FastByteArrayOutputStream[ two2h ];

    for ( int i = 0; i < two2h; i++ )
      cachePointer[ i ] = new OutputBitStream( cachePointerByte[ i ] = new FastByteArrayOutputStream(), 0 );

    cacheSkip = new OutputBitStream[ two2h ];
    cacheSkipBitCount = new OutputBitStream[ two2h ];
    cacheSkipByte = new FastByteArrayOutputStream[ two2h ];

    for ( int i = 0; i < two2h; i++ ) {
      cacheSkip[ i ] = new OutputBitStream( cacheSkipByte[ i ] = new FastByteArrayOutputStream(), 0 );
      cacheSkipBitCount[ i ] = new OutputBitStream( NullOutputStream.getInstance(), 0 );
    }

    skipPointer = new int[ two2h + 1 ];
    distance = new long[ two2h + 1 ];
View Full Code Here

Examples of it.unimi.dsi.fastutil.io.FastByteArrayOutputStream

    cacheDataLength = new int[ two2h ];
    cachePointer = new OutputBitStream[ two2h ];
    cachePointerByte = new FastByteArrayOutputStream[ two2h ];

    for ( int i = 0; i < two2h; i++ )
      cachePointer[ i ] = new OutputBitStream( cachePointerByte[ i ] = new FastByteArrayOutputStream(), 0 );

    cacheSkip = new OutputBitStream[ two2h ];
    cacheSkipBitCount = new OutputBitStream[ two2h ];
    cacheSkipByte = new FastByteArrayOutputStream[ two2h ];

    for ( int i = 0; i < two2h; i++ ) {
      cacheSkip[ i ] = new OutputBitStream( cacheSkipByte[ i ] = new FastByteArrayOutputStream(), 0 );
      cacheSkipBitCount[ i ] = new OutputBitStream( NullOutputStream.getInstance(), 0 );
    }

    skipPointer = new int[ two2h + 1 ];
    distance = new long[ two2h + 1 ];
View Full Code Here

Examples of it.unimi.dsi.fastutil.io.FastByteArrayOutputStream

public class TestDowncaseTermProcessor extends TestCase {

  public void testReadResolve() throws IOException, ClassNotFoundException {
    TermProcessor t = DowncaseTermProcessor.getInstance();
    FastByteArrayOutputStream os = new FastByteArrayOutputStream();
    BinIO.storeObject( t, os );
    assertTrue( t == (TermProcessor)BinIO.loadObject( new FastByteArrayInputStream( os.array ) ) );
  }
View Full Code Here

Examples of it.unimi.dsi.fastutil.io.FastByteArrayOutputStream

  /** Checks that a given payload serialises correctly.
   *
   * @param payload a payload containing a current value.
   */
  public static void testWriteAndRead( Payload payload ) throws IOException {
    final FastByteArrayOutputStream fbos = new FastByteArrayOutputStream();
    final OutputBitStream obs = new OutputBitStream( fbos );
    Object o = payload.get();
    payload.write( obs );
    obs.flush();
    final InputBitStream ibs = new InputBitStream( fbos.array );
View Full Code Here

Examples of jodd.io.FastByteArrayOutputStream

          }
        }
        putFile(header.formFieldName, newFile);
      } else {
        // no file, therefore it is regular form parameter.
        FastByteArrayOutputStream fbos = new FastByteArrayOutputStream();
        input.copyAll(fbos);
        String value = encoding != null ? new String(fbos.toByteArray(), encoding) : new String(fbos.toByteArray());
        putParameter(header.formFieldName, value);
      }

      input.skipBytes(1);
      input.mark(1);
View Full Code Here

Examples of net.sf.toxicity.util.FastByteArrayOutputStream

    public ServletOutputStream getOutputStream() {
        if (bufferedStream == null) {
            if (bufferedWriter != null) {
                throw new IllegalStateException("response.getOutputStream() called after response.getWriter()");
            }
            bufferedStream = new FastByteArrayOutputStream();
            exposedStream = new ServletOutputStream() {
                public void write(int b) {
                    bufferedStream.write(b);
                }
            };
View Full Code Here

Examples of org.apache.cassandra.io.util.FastByteArrayOutputStream

        columnFamilies = null;
    }
   
    public Message getMessage(Integer version)
    {
      FastByteArrayOutputStream bos = new FastByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(bos);
        try
        {
            StreamRequestMessage.serializer().serialize(this, dos, version);
        }
        catch (IOException e)
        {
            throw new IOError(e);
        }
        return new Message(FBUtilities.getBroadcastAddress(), StorageService.Verb.STREAM_REQUEST, bos.toByteArray(), version);
    }
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.