Examples of Encoder


Examples of SevenZip.Compression.LZMA.Encoder

  public long compress(InputStream is, OutputStream os, long maxReadLength, long maxWriteLength) throws IOException, CompressionOutputSizeException {
    CountedInputStream cis = null;
    CountedOutputStream cos = null;
    cis = new CountedInputStream(is);
    cos = new CountedOutputStream(os);
    Encoder encoder = new Encoder();
        encoder.SetEndMarkerMode( true );
        int dictionarySize = 1;
        if(maxReadLength == Long.MAX_VALUE || maxReadLength < 0) {
          dictionarySize = MAX_DICTIONARY_SIZE;
          Logger.error(this, "No indication of size, having to use maximum dictionary size", new Exception("debug"));
        } else {
          while(dictionarySize < maxReadLength && dictionarySize < MAX_DICTIONARY_SIZE)
            dictionarySize <<= 1;
        }
        encoder.SetDictionarySize( dictionarySize );
        encoder.WriteCoderProperties(os);
        encoder.Code( cis, cos, maxReadLength, maxWriteLength, null );
    if(cos.written() > maxWriteLength)
      throw new CompressionOutputSizeException(cos.written());
        cos.flush();
    if(logMINOR)
      Logger.minor(this, "Read "+cis.count()+" written "+cos.written());
View Full Code Here

Examples of SevenZip.Compression.LZMA.Encoder

  public long compress(InputStream is, OutputStream os, long maxReadLength, long maxWriteLength) throws IOException, CompressionOutputSizeException {
    CountedInputStream cis = null;
    CountedOutputStream cos = null;
    cis = new CountedInputStream(is);
    cos = new CountedOutputStream(os);
    Encoder encoder = new Encoder();
        encoder.SetEndMarkerMode( true );
        // Dictionary size 1MB, this is equivalent to lzma -4, it uses 16MB to compress and 2MB to decompress.
        // Next one up is 2MB = -5 = 26M compress, 3M decompress.
        encoder.SetDictionarySize( 1 << 20 );
        // enc.WriteCoderProperties( out );
        // 5d 00 00 10 00
        encoder.Code( cis, cos, -1, -1, null );
    if(logMINOR)
      Logger.minor(this, "Read "+cis.count()+" written "+cos.written());
    if(cos.written() > maxWriteLength)
      throw new CompressionOutputSizeException();
    cos.flush();
View Full Code Here

Examples of SevenZip.Compression.LZMA.Encoder

    EncoderThread(OutputStream _out, Integer dictSzPow2, Integer fastBytes)
    {
        q = ConcurrentBufferOutputStream.newQueue();
        in = ConcurrentBufferInputStream.create(q);
        out = _out;
        enc = new Encoder();
        exn = null;
        enc.SetDictionarySize(1 << (dictSzPow2 == null ? DEFAULT_DICT_SZ_POW2
                : dictSzPow2).intValue());
        if (fastBytes != null)
        {
View Full Code Here

Examples of br.net.woodstock.rockframework.security.Encoder

      throw new IllegalArgumentException("type must be not null");
    }
    if (this.value == null) {
      return;
    }
    Encoder encoder = this.getEncoderFromType(this.type);

    if (encoder == null) {
      throw new IllegalArgumentException("encoder not found for type '" + this.type + "'");
    }
View Full Code Here

Examples of co.cask.cdap.common.io.Encoder

  }

  @Override
  public byte[] encode(KeyIdentifier keyIdentifier) throws IOException {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    Encoder encoder = new BinaryEncoder(bos);

    encoder.writeInt(KeyIdentifier.Schemas.getVersion());
    DatumWriter<KeyIdentifier> writer = writerFactory.create(KEY_IDENTIFIER_TYPE,
                                                             KeyIdentifier.Schemas.getCurrentSchema());
    writer.encode(keyIdentifier, encoder);
    return bos.toByteArray();
  }
View Full Code Here

Examples of co.cask.tigon.io.Encoder

  // many entries will have no hash keys. Serialize that once and for good
  private static byte[] serializeEmptyHashKeys() {
    try {
      // we don't synchronize here: the worst thing that go wrong here is repeated assignment to the same value
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
      Encoder encoder = new BinaryEncoder(bos);
      encoder.writeInt(0);
      return bos.toByteArray();
    } catch (IOException e) {
      throw new RuntimeException("encoding empty hash keys went wrong - bailing out: " + e.getMessage(), e);
    }
  }
View Full Code Here

Examples of com.corundumstudio.socketio.parser.Encoder

        scheduler = new CancelableScheduler(configuration.getHeartbeatThreadPoolSize());

        ackManager = new AckManager(scheduler);

        JsonSupport jsonSupport = configuration.getJsonSupport();
        Encoder encoder = new Encoder(jsonSupport);
        Decoder decoder = new Decoder(jsonSupport, ackManager);

        heartbeatHandler = new HeartbeatHandler(configuration, scheduler);
        PacketListener packetListener = new PacketListener(heartbeatHandler, ackManager, namespacesHub);
View Full Code Here

Examples of com.floreysoft.jmte.encoder.Encoder

    if (renderedResult == null || renderedResult.equals("")) {
      return renderedResult;
    } else {
      final String prefixedRenderedResult = (prefix != null ? prefix : "") + renderedResult + (suffix != null ? suffix : "");
      Encoder encoder = context.getEncoder();
      if (!rawRendering && encoder != null) {
        final String encodedPrefixedRenderedResult = encoder.encode(prefixedRenderedResult);
        return encodedPrefixedRenderedResult;
      } else {
        return prefixedRenderedResult;
      }
    }
View Full Code Here

Examples of com.google.code.yanf4j.core.CodecFactory.Encoder

    }


    @Test
    public void testEncodeNormal() throws Exception {
        Encoder encoder = this.codecFactory.getEncoder();
        Assert.assertNotNull(encoder);
        IoBuffer buffer = encoder.encode(IoBuffer.wrap("hello".getBytes("utf-8")), null);
        Assert.assertNotNull(buffer);
        Assert.assertTrue(buffer.hasRemaining());
        Assert.assertArrayEquals("hello".getBytes("utf-8"), buffer.array());

    }
View Full Code Here

Examples of com.itstherules.mediacentre.freemarker.method.Encoder

    writer.close();
  }
 
  private void populate(Map<String, Object> map) {
    map.put("niceify", new NiceifyName());
    map.put("encode", new Encoder());
    map.put("host", new HostScalar().value());
    }
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.