mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-06 03:50:19 +02:00
plucker support (in progress)
git-svn-id: https://only.mawhrin.net/repos/FBReaderJ/trunk@826 6a642e6f-84f6-412e-ac94-c4a38d5a04b0
This commit is contained in:
parent
839ab9fa60
commit
34d0f3aa85
9 changed files with 967 additions and 948 deletions
64
src/org/geometerplus/fbreader/formats/pdb/PdbHeader.java
Normal file
64
src/org/geometerplus/fbreader/formats/pdb/PdbHeader.java
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2008 Geometer Plus <contact@geometerplus.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package org.geometerplus.fbreader.formats.pdb;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class PdbHeader {
|
||||
static public String DocName;
|
||||
static public short Flags;
|
||||
static public String Id;
|
||||
static public int[] Offsets;
|
||||
|
||||
public boolean read(InputStream stream) throws IOException {
|
||||
final byte[] buffer = new byte[32];
|
||||
if (stream.read(buffer, 0, 32) != 32) {
|
||||
return false;
|
||||
}
|
||||
DocName = new String(buffer);
|
||||
Flags = PdbUtil.readShort(stream);
|
||||
|
||||
stream.skip(26);
|
||||
|
||||
if (stream.read(buffer, 0, 8) != 8) {
|
||||
return false;
|
||||
}
|
||||
Id = new String(buffer, 0, 8);
|
||||
|
||||
stream.skip(8);
|
||||
|
||||
short numRecords = PdbUtil.readShort(stream);
|
||||
if (numRecords <= 0) {
|
||||
return false;
|
||||
}
|
||||
Offsets = new int[numRecords];
|
||||
|
||||
for (int i = 0; i < numRecords; ++i) {
|
||||
Offsets[i] = stream.read();
|
||||
if (stream.skip(4) != 4) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue