Giter VIP home page Giter VIP logo

fressian's People

Contributors

clojure-build avatar puredanger avatar stuarthalloway avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fressian's Issues

Fressian has absolutely no JavaDoc

I'm the author of a library that provides Java bindings for Clojure's data modeling and serialization capabilities. I've been working on adding Fressian support and I've noticed that, other than the StreamingWriter class, the Fressian library is not at all self-documenting. There is some out-of-band documentation on GitHub, but many crucial concepts (e.g. InheritanceLookup) I had to figure out by reading code. It's true that data.fressian is fairly self-documenting, but I'm targeting Java developers who would be coding directly against the Java reference implementation and not the Clojure bindings.

UTF-16 surrogate pairs intentionally not supported?

It appears that the implementation of the UTF-8 encoding wasn't written to properly support UTF-16 surrogate pairs. Was this intentional? If you provide a surrogate pair to the api now you end up with 6 bytes instead of the expected 4 defined by UTF-8.

It will decode correctly using the corresponding decoding implementation but standard implementations of the UTF-8 decoders will not be able to properly decode it.

Writing an open list and then a footer causes an off by one error

If you write an open list, end it, and then write a footer the validation logic for the number of bytes fails. The length reported in the footer and the calculated length are off by one. Here is a example that produces the error

(require '[clojure.data.fressian :as fress])
(import '[org.fressian.impl ByteBufferInputStream BytesOutputStream InheritanceLookup])
(let [my-os (BytesOutputStream.)
      fw (fress/create-writer my-os) ]
  (do
   (fress/begin-open-list fw)
   (fress/end-list fw)
   (fress/write-footer fw)
   (fress/write-object fw nil)
   (let [ my-is (fress/to-input-stream (.internalBuffer my-os))
         fr (fress/create-reader my-is)]
     [(fress/read-object fr) (fress/read-object fr)])))

I believe the cause is in the beginOpenList method of FressianWriter

public Writer beginOpenList() throws IOException {
        if (0 != rawOut.getBytesWritten())
            throw new IllegalStateException("openList must be called from the top level, outside any footer context.");
        writeCode(Codes.BEGIN_OPEN_LIST);
        rawOut.reset();
        return this;
    }

The byte code for the open list is written, then the stream is reset making the reported number of bytes written zero, not one.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.