Tabnine Logo
StreamingEncoder.encode
Code IndexAdd Tabnine to your IDE (free)

How to use
encode
method
in
de.huxhorn.sulky.codec.streaming.StreamingEncoder

Best Java code snippets using de.huxhorn.sulky.codec.streaming.StreamingEncoder.encode (Showing top 7 results out of 315)

origin: de.huxhorn.sulky/de.huxhorn.sulky.codec

  @Override
  public void encode(E obj, OutputStream into) throws IOException
  {
    encoder.encode(obj, into);
  }
}
origin: huxi/sulky

  @Override
  public void encode(E obj, OutputStream into) throws IOException
  {
    encoder.encode(obj, into);
  }
}
origin: de.huxhorn.sulky/de.huxhorn.sulky.codec

  @Override
  public void encode(E obj, OutputStream into) throws IOException
  {
    GZIPOutputStream gos=new GZIPOutputStream(into);
    wrapped.encode(obj, gos);
    gos.finish();
  }
}
origin: huxi/sulky

  @Override
  public void encode(E obj, OutputStream into) throws IOException
  {
    GZIPOutputStream gos=new GZIPOutputStream(into);
    wrapped.encode(obj, gos);
    gos.finish();
  }
}
origin: huxi/sulky

  @Override
  @SuppressWarnings("PMD.ReturnEmptyArrayRatherThanNull")
  public byte[] encode(E object)
  {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    try
    {
      wrapped.encode(object, bos);
      return bos.toByteArray();
    }
    catch (IOException e)
    {
      if(logger.isWarnEnabled()) logger.warn("Exception while encoding {}!", object, e);
    }
    return null;
  }
}
origin: de.huxhorn.sulky/de.huxhorn.sulky.codec

  @Override
  @SuppressWarnings("PMD.ReturnEmptyArrayRatherThanNull")
  public byte[] encode(E object)
  {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    try
    {
      wrapped.encode(object, bos);
      return bos.toByteArray();
    }
    catch (IOException e)
    {
      if(logger.isWarnEnabled()) logger.warn("Exception while encoding {}!", object, e);
    }
    return null;
  }
}
origin: huxi/sulky

  @Test
  public void test() throws IOException
  {
    String obj = "Foo";
    StreamingEncoder<String> encoder = new GZIPStreamingEncoderWrapper<>(new StreamingSerializableCodec<>());
    StreamingDecoder<String> decoder = new GZIPStreamingDecoderWrapper<>(new StreamingSerializableCodec<>());
    ByteArrayOutputStream bos=new ByteArrayOutputStream();
    encoder.encode(obj, bos);
    ByteArrayInputStream bis=new ByteArrayInputStream(bos.toByteArray());
    String decoded = decoder.decode(bis);
    assertEquals(obj, decoded);
  }
}
de.huxhorn.sulky.codec.streamingStreamingEncoderencode

Popular methods of StreamingEncoder

    Popular in Java

    • Parsing JSON documents to java classes using gson
    • orElseThrow (Optional)
      Return the contained value, if present, otherwise throw an exception to be created by the provided s
    • scheduleAtFixedRate (Timer)
    • runOnUiThread (Activity)
    • ConnectException (java.net)
      A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
    • ArrayList (java.util)
      ArrayList is an implementation of List, backed by an array. All optional operations including adding
    • LinkedHashMap (java.util)
      LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
    • Response (javax.ws.rs.core)
      Defines the contract between a returned instance and the runtime when an application needs to provid
    • StringUtils (org.apache.commons.lang)
      Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
    • Table (org.hibernate.mapping)
      A relational table
    • Github Copilot alternatives
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now