- @Override
- public int read(ByteBuffer dst) throws IOException {
- int pos = dst.position();
- int limit = dst.limit();
- int i=stream.read(dst.array(), pos, limit-pos);
- //LOGGER.warn("Read " + i + " (expected " + dst.array().length + ")");
- return i;
+ /**
+ * Reads a {@link DataContainer} containing a {@link TransferableGraph1}
+ * structure from the specified InputStream. Note that this implementation does
+ * not close the specified <code>input</code> stream, it is expected to be
+ * closed by the caller.
+ *
+ * @param input the input stream to read from
+ * @return the TG contained by the stream
+ * @throws IOException
+ */
+ public static TransferableGraph1 read(InputStream input) throws IOException {
+ try (TransferableGraphFileReader reader = new TransferableGraphFileReader(input)) {
+ return reader.readTG();