X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.graph%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Frepresentation%2FTransferableGraphFileReader.java;fp=bundles%2Forg.simantics.graph%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Frepresentation%2FTransferableGraphFileReader.java;h=6fc7ac5516f5cc9efb7da5f8cd3a4f588565fb54;hp=56a112e4d02e7a7e768375618bf687bab437b3ef;hb=59cab457bcc89618e8557235fd65eaecbe583592;hpb=85eac68ed3cae0996c54b536a2f2a49abf8fc303 diff --git a/bundles/org.simantics.graph/src/org/simantics/graph/representation/TransferableGraphFileReader.java b/bundles/org.simantics.graph/src/org/simantics/graph/representation/TransferableGraphFileReader.java index 56a112e4d..6fc7ac551 100644 --- a/bundles/org.simantics.graph/src/org/simantics/graph/representation/TransferableGraphFileReader.java +++ b/bundles/org.simantics.graph/src/org/simantics/graph/representation/TransferableGraphFileReader.java @@ -53,46 +53,9 @@ final public class TransferableGraphFileReader extends ByteFileReader { } }; - - - final static class InputChannel implements ReadableByteChannel { - - final private InputStream stream; - - public InputChannel(InputStream stream) { - this.stream = stream; - } - - @Override - public boolean isOpen() { - return true; - } - - @Override - public void close() throws IOException { - // NOTE: it is an intentional choice not to close the underlying stream here - // InputStreams given directly to TransferableGraphFileReader are expected to - // be closed outside of this implementation. - } - - @Override - public int read(ByteBuffer dst) throws IOException { - int nRead; - int size = 0; - int position = dst.position(); - int limit = dst.limit(); - // The users of this channel expect that the data is fully read at this point - while ((nRead = stream.read(dst.array(), position, limit - position)) != -1 && limit - position > 0) { - size += nRead; - position += nRead; - } - return size; - } - } - private static boolean init = true; - + final private static int SIZE = 1<<18; final private static int HEADER = headerSize(); final private int header;