Search in sources :

Example 11 with BlobHeader

use of de.topobyte.osm4j.pbf.util.BlobHeader in project osm4j-pbf by topobyte.

the class CopyBlockwise method copyAllBlocks.

private static void copyAllBlocks() throws IOException {
    while (true) {
        try {
            BlobHeader header = PbfUtil.parseHeader(data);
            Fileformat.Blob blob = PbfUtil.parseBlock(data, header.getDataLength());
            blockWriter.write(header.getType(), null, blob);
        } catch (EOFException eof) {
            break;
        }
    }
}
Also used : BlobHeader(de.topobyte.osm4j.pbf.util.BlobHeader) EOFException(java.io.EOFException) Fileformat(de.topobyte.osm4j.pbf.protobuf.Fileformat)

Example 12 with BlobHeader

use of de.topobyte.osm4j.pbf.util.BlobHeader in project osm4j-pbf by topobyte.

the class CopyBlockwise method copyBlocks.

private static void copyBlocks(int nBlocks) throws IOException {
    for (int i = 0; i < nBlocks; i++) {
        try {
            BlobHeader header = PbfUtil.parseHeader(data);
            Fileformat.Blob blob = PbfUtil.parseBlock(data, header.getDataLength());
            blockWriter.write(header.getType(), null, blob);
        } catch (EOFException eof) {
            break;
        }
    }
}
Also used : BlobHeader(de.topobyte.osm4j.pbf.util.BlobHeader) EOFException(java.io.EOFException) Fileformat(de.topobyte.osm4j.pbf.protobuf.Fileformat)

Aggregations

BlobHeader (de.topobyte.osm4j.pbf.util.BlobHeader)12 Fileformat (de.topobyte.osm4j.pbf.protobuf.Fileformat)10 EOFException (java.io.EOFException)10 BlockData (de.topobyte.osm4j.pbf.util.BlockData)6 DataInputStream (java.io.DataInputStream)6 FileInputStream (java.io.FileInputStream)6 InputStream (java.io.InputStream)6 BlockWriter (de.topobyte.osm4j.pbf.seq.BlockWriter)4 FileOutputStream (java.io.FileOutputStream)4 OutputStream (java.io.OutputStream)4 Osmformat (de.topobyte.osm4j.pbf.protobuf.Osmformat)3 IOException (java.io.IOException)2 ByteString (com.google.protobuf.ByteString)1 HeaderBBox (de.topobyte.osm4j.pbf.protobuf.Osmformat.HeaderBBox)1