Broken VirtualRoot.Entry.outputStream() #639

Closed
DavePearce opened this Issue Apr 24, 2016 · 0 comments

Projects

None yet

1 participant

@DavePearce
Member

The following method in wyfs.util.VirtualRoot.Entry is broken:

public OutputStream outputStream() {
            lastModified = System.currentTimeMillis();
            data = new byte[0];
            // create an output stream which will automatically resize the given
            // array.
            return new OutputStream() {
                private int pos = 0;

                public void write(int b) {
                    if (pos >= data.length) {
                        data = Arrays.copyOf(data, (data.length + 1) * 2);
                    }
                    data[pos++] = (byte) b;
                }
            };
        }

It's broken because it leaves empty bytes at the end of final array.

@DavePearce DavePearce self-assigned this Apr 24, 2016
@DavePearce DavePearce added this to the ChangeList Pre v0.4.0 milestone Apr 24, 2016
@DavePearce DavePearce closed this Apr 24, 2016
@DavePearce DavePearce added a commit that referenced this issue Apr 24, 2016
@DavePearce DavePearce Fix for #639
This was a simple problem related to the way that VirtualRool was
handling outputstreams for its contained Entry's.
2b1dcbf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment