protected void readBlockMap() throws IOException { /* Only need to read the block map at most once, it is invariant. On the rare occasions when we do write to the virtualdisk, we update the block map in both local memory and out to the file, so the two are always synchronized. */ if( blockMap != null ) return; int N = (int)header.blockCount(); blockMap = new int[N]; RandomAccessFile raf = new RandomAccessFile( source, "r" ); raf.seek( header.blocksOffset() ); byte[] ba = new byte[4*N]; raf.readFully( ba ); raf.close(); // LOOK: We are assuming little-endian formats, seems to hold... for( int i = 0; i < N; i++ ) { blockMap[i] = (int)EndianUtils.readSwappedUnsignedInteger ( ba, 4*i ); } checkBlockMap(); }
static private UUID readFrom( byte[] ba, int offset ) { long timeLow = EndianUtils.readSwappedUnsignedInteger ( ba, offset ); int timeMidI = EndianUtils.readSwappedUnsignedShort ( ba, offset + 4 ); long timeMid = timeMidI & 0xffffffffL; int versionTimeHiI = EndianUtils.readSwappedUnsignedShort ( ba, offset + 6 ); long versionTimeHi = versionTimeHiI & 0xffffffffL; long msb = (timeLow << 32) | (timeMid << 16) | versionTimeHi; /* int reservedClockSeqI = EndianUtils.readSwappedUnsignedShort ( ba, offset + 10 ); long reservedClockSeq = reservedClockSeqI & 0xffffffffL; */ long lsb = 0; for( int i = 0; i < 8; i++ ) lsb |= (ba[offset+8+i] & 0xffL) << (56 - 8*i); return new UUID( msb, lsb ); }
public String getSerialNumber() { int serial0 = EndianUtils.readSwappedInteger(mData, 8); int serial1 = EndianUtils.readSwappedInteger(mData, 12); int serial2 = EndianUtils.readSwappedInteger(mData, 16); int serial3 = EndianUtils.readSwappedInteger(mData, 20); StringBuilder sb = new StringBuilder(); sb.append(String.format("%08X", serial0)); sb.append("-"); sb.append(String.format("%08X", serial1)); sb.append("-"); sb.append(String.format("%08X", serial2)); sb.append("-"); sb.append(String.format("%08X", serial3)); return sb.toString(); }
private void decodeBitmap(String filename) throws IOException { System.out.println("Decoding " + filename); File inputFile = new File(filename); File outputFile = new File(outputDirectory + File.separator + FilenameUtils.removeExtension(inputFile.getName())); FileInputStream fis = new FileInputStream(filename); //skip 6 bytes fis.skip(6); //read the length we encoded int fileSize = EndianUtils.readSwappedInteger(fis); //skip the rest of the header fis.skip(44); Files.copy(fis, outputFile.toPath(), StandardCopyOption.REPLACE_EXISTING); //truncate the file FileChannel outChan = new FileOutputStream(outputFile, true).getChannel(); outChan.truncate(fileSize); outChan.close(); //clean up if (isCleanUp()) { //delete the bitmap System.out.println("Deleting: " + inputFile); FileUtils.deleteQuietly(inputFile); } }
protected void writeBlockMap() throws IOException { int N = (int)header.blockCount(); byte[] ba = new byte[4*N]; log.info( "Writing BlockMap for : " + source ); for( int i = 0; i < N; i++ ) { EndianUtils.writeSwappedInteger( ba, 4*i, blockMap[i] ); } RandomAccessFile raf = new RandomAccessFile( source, "rw" ); raf.seek( header.blocksOffset() ); raf.write( ba ); raf.close(); }
PreHeader( DataInput di ) throws IOException { byte[] ba = new byte[SIZEOF]; di.readFully( ba ); sig = EndianUtils.readSwappedUnsignedInteger( ba, 64 ); if( sig != VDI_IMAGE_SIGNATURE ) /* LOOK: really want to know the source file exhibiting the error */ throw new VDIMissingSignatureException(); version = EndianUtils.readSwappedUnsignedInteger( ba, 68 ); }
public RTUUID( byte[] ba ) throws IOException { u32TimeLow = EndianUtils.readSwappedUnsignedInteger( ba, 0 ); u16TimeMid = EndianUtils.readSwappedUnsignedShort( ba, 4 ); u16TimeHiAndVersion = EndianUtils.readSwappedUnsignedShort( ba, 6); u8ClockSeqHiAndReserved = ba[8] & 0xff; u8ClockSeqLow = ba[9] & 0xff; au8Node = new int[6]; for( int i = 0; i < 6; i++ ) { au8Node[i] = ba[10+i] & 0xff; } }
public GrainDirectory( byte[] raw ) { gdes = new long[raw.length/4]; for( int i = 0; i < gdes.length; i++ ) { long gt = EndianUtils.readSwappedUnsignedInteger( raw, 4*i ); gdes[i] = gt; } }
public GrainTable( byte[] raw ) { if( raw.length != SIZEOF ) { throw new IllegalArgumentException ( "GrainTable raw buffer length " + raw.length + ", expected " + SIZEOF); } gtes = new long[512]; for( int i = 0; i < gtes.length; i++ ) { long gte = EndianUtils.readSwappedUnsignedInteger( raw, 4*i ); gtes[i] = gte; } }
static GrainMarker readFrom( DataInput di ) throws IOException { long l = di.readLong(); long lba = EndianUtils.swapLong( l ); int i = di.readInt(); int size = EndianUtils.swapInteger( i ); return new GrainMarker( lba, size ); }
static MetadataMarker readFrom( DataInput di ) throws IOException { long l = di.readLong(); long numSectors = EndianUtils.swapLong( l ); int i = di.readInt(); int size = EndianUtils.swapInteger( i ); // LOOK: check size is zero i = di.readInt(); int type = EndianUtils.swapInteger( i ); return new MetadataMarker( numSectors, type ); }
/** * Queries the device for available sample rates. Will always provide at * least the default 10 MHz sample rate. */ private void determineAvailableSampleRates() throws LibUsbException, UsbException { mSampleRates.clear(); //Get a count of available sample rates. If we get an exception, then //we're using an older firmware revision and only the default 10 MHz //rate is supported try { byte[] rawCount = readArray(Command.GET_SAMPLE_RATES, 0, 0, 4); if(rawCount != null) { int count = EndianUtils.readSwappedInteger(rawCount, 0); byte[] rawRates = readArray(Command.GET_SAMPLE_RATES, 0, count, (count * 4)); for(int x = 0; x < count; x++) { int rate = EndianUtils.readSwappedInteger(rawRates, (x * 4)); mSampleRates.add(new AirspySampleRate(x, rate, formatSampleRate(rate))); } } } catch(LibUsbException e) { //Press on, nothing else to do here .. } if(mSampleRates.isEmpty()) { mSampleRates.add(DEFAULT_SAMPLE_RATE); } }
public int read(Request request, int value, int index, int length) throws UsbException { if(!(length == 1 || length == 2 || length == 4)) { throw new IllegalArgumentException("invalid length [" + length + "] must be: byte=1, short=2, int=4 to read a primitive"); } ByteBuffer buffer = readArray(request, value, index, length); byte[] data = new byte[buffer.capacity()]; buffer.get(data); switch(data.length) { case 1: return data[0]; case 2: return EndianUtils.readSwappedShort(data, 0); case 4: return EndianUtils.readSwappedInteger(data, 0); default: throw new UsbException("read() primitive returned an " + "unrecognized byte array " + Arrays.toString(data)); } }
public String getPartID() { int part0 = EndianUtils.readSwappedInteger(mData, 0); int part1 = EndianUtils.readSwappedInteger(mData, 4); StringBuilder sb = new StringBuilder(); sb.append(String.format("%08X", part0)); sb.append("-"); sb.append(String.format("%08X", part1)); return sb.toString(); }
/** * Queries the device for available sample rates. Will always provide at * least the default 10 MHz sample rate. */ private void determineAvailableSampleRates() throws LibUsbException, DeviceException { mSampleRates.clear(); mSampleRates.add( DEFAULT_SAMPLE_RATE ); //Get a count of available sample rates. If we get an exception, then //we're using an older firmware revision and only the default 10 MHz //rate is supported try { byte[] rawCount = readArray( Command.GET_SAMPLE_RATES, 0, 0, 4 ); if( rawCount != null ) { int count = EndianUtils.readSwappedInteger( rawCount, 0 ); byte[] rawRates = readArray( Command.GET_SAMPLE_RATES, 0, count, ( count * 4 ) ); for( int x = 0; x < count; x++ ) { int rate = EndianUtils.readSwappedInteger( rawRates, ( x * 4 ) ); if( rate != DEFAULT_SAMPLE_RATE.getRate() ) { mSampleRates.add( new AirspySampleRate( x, rate, formatSampleRate( rate ) ) ); } } } } catch( LibUsbException e ) { //Press on, nothing else to do here .. } }
public static DBFHeader read(final DataInputStream dataInput) throws IOException { final DBFHeader header = new DBFHeader(); header.signature = dataInput.readByte(); /* 0 */ header.year = dataInput.readByte(); /* 1 */ header.month = dataInput.readByte(); /* 2 */ header.day = dataInput.readByte(); /* 3 */ header.numberOfRecords = EndianUtils.readSwappedInteger(dataInput); //DbfUtils.readLittleEndianInt(dataInput); /* 4-7 */ header.headerLength = EndianUtils.readSwappedShort(dataInput);//DbfUtils.readLittleEndianShort(dataInput); /* 8-9 */ header.recordLength = EndianUtils.readSwappedShort(dataInput);//DbfUtils.readLittleEndianShort(dataInput); /* 10-11 */ header.reserved1 = dataInput.readShort();//DbfUtils.readLittleEndianShort(dataInput); /* 12-13 */ header.incompleteTransaction = dataInput.readByte(); /* 14 */ header.encryptionFlag = dataInput.readByte(); /* 15 */ header.freeRecordThread = dataInput.readInt();//DbfUtils.readLittleEndianInt(dataInput); /* 16-19 */ header.reserved2 = dataInput.readInt(); /* 20-23 */ header.reserved3 = dataInput.readInt(); /* 24-27 */ header.mdxFlag = dataInput.readByte(); /* 28 */ header.languageDriver = dataInput.readByte(); /* 29 */ header.reserved4 = dataInput.readShort();//DbfUtils.readLittleEndianShort(dataInput); /* 30-31 */ header.fields = new ArrayList<DBFField>(); DBFField field; while ((field = DBFField.read(dataInput)) != null) { header.fields.add(field); } header.numberOfFields = header.fields.size(); return header; }
public void doHandle(byte[] data, SettableFuture<Object> future, Integer socketId) { ByteBuffer byteBuffer = ByteBuffer.wrap(data); byte[] bytes4 = new byte[4]; byteBuffer.get(bytes4); int code = (int) EndianUtils.readSwappedUnsignedInteger(bytes4, 0); if (code == 0){ byte[] txBytes = new byte[data.length - 4]; byteBuffer.get(txBytes); Transaction tx = new Transaction(MainNetParams.get(), txBytes); future.set(tx); } else { future.setException(new ObeliskException(code)); } }
public void doHandle(byte[] data, SettableFuture<Object> future, Integer socketId) { ByteBuffer byteBuffer = ByteBuffer.wrap(data); byte[] bytes4 = new byte[4]; byteBuffer.get(bytes4); int code = (int) EndianUtils.readSwappedUnsignedInteger(bytes4, 0); if (code == 0){ byte[] bytes = new byte[4]; byteBuffer.get(bytes); long height = EndianUtils.readSwappedUnsignedInteger(bytes, 0); future.set(height); } else { future.setException(new ObeliskException(code)); } }
@Override public void doHandle(byte[] data, SettableFuture<Object> future, Integer socketId) { ByteBuffer byteBuffer = ByteBuffer.wrap(data); byte[] bytes4 = new byte[4]; byteBuffer.get(bytes4); int code = (int) EndianUtils.readSwappedUnsignedInteger(bytes4, 0); if (code == 0){ byteBuffer.get(bytes4); long version = EndianUtils.readSwappedUnsignedInteger(bytes4, 0); byte[] previousBlockHash = new byte[32]; byteBuffer.get(previousBlockHash); ArrayUtils.reverse(previousBlockHash); byte[] merkle = new byte[32]; byteBuffer.get(merkle); ArrayUtils.reverse(merkle); byteBuffer.get(bytes4); long timestamp = EndianUtils.readSwappedUnsignedInteger(bytes4, 0); byteBuffer.get(bytes4); long bits = EndianUtils.readSwappedUnsignedInteger(bytes4, 0); byteBuffer.get(bytes4); long nonce = EndianUtils.readSwappedUnsignedInteger(bytes4, 0); BlockHeader header = new BlockHeader(); header.setVersion(version); header.setPreviousBlockHash(previousBlockHash); header.setMerkle(merkle); header.setTimestamp(timestamp); header.setBits(bits); header.setNonce(nonce); future.set(header); } else { future.setException(new ObeliskException(code)); } }
@Override public void doHandle(byte[] data, SettableFuture<Object> future, Integer socketId) { ByteBuffer byteBuffer = ByteBuffer.wrap(data); byte[] bytes4 = new byte[4]; byteBuffer.get(bytes4); int code = (int) EndianUtils.readSwappedUnsignedInteger(bytes4, 0); if (code == 0) { future.set(true); } else { LOG.error("renew error - " + code); future.setException(new ObeliskException(code)); } }
public void doHandle(byte[] data, SettableFuture<Object> future, Integer socketId) { ByteBuffer byteBuffer = ByteBuffer.wrap(data); byte[] bytes4 = new byte[4]; byteBuffer.get(bytes4); int code = (int) EndianUtils.readSwappedUnsignedInteger(bytes4, 0); if (code == 0){ future.set(true); } else { future.setException(new ObeliskException(code)); } }
public Future<Object> subscribe(final Address addr, final Listener listener) { Future<Object> f = clientBase.request("address.subscribe", addressToBytes(addr), new ResponseHandler() { public void doHandle(byte[] data, SettableFuture<Object> future, Integer socketId) { try { ByteBuffer byteBuffer = ByteBuffer.wrap(data); byte[] bytes4 = new byte[4]; byteBuffer.get(bytes4); int code = (int) EndianUtils.readSwappedUnsignedInteger(bytes4, 0); if (code == 0) { Set<Address> addresses = listeningAddresses.get(socketId); if (addresses == null) { addresses = Collections.synchronizedSet(new HashSet<Address>()); listeningAddresses.put(socketId, addresses); } addresses.add(addr); if (listener != null) listeners.put(addr, listener); future.set(socketId); } else { future.setException(new ObeliskException(code)); } } catch (Exception e) { future.setException(e); } } }); return f; }
public Future<Object> fetchHistory(Address addr, int fromHeight, FetchHistoryHandler handler) { byte[] hash160 = ArrayUtils.clone(addr.getHash160()); ArrayUtils.reverse(hash160); ByteBuffer byteBuffer = ByteBuffer.allocate(ADDRESS_VERSION_SIZE + ADDRESS_HASH_SIZE + HEIGHT_SIZE); byteBuffer.put((byte) addr.getVersion()); byteBuffer.put(hash160); byte[] bytes = new byte[4]; EndianUtils.writeSwappedInteger(bytes, 0, fromHeight); byteBuffer.put(bytes); Future<Object> f = clientBase.request("address.fetch_history", byteBuffer.array(), handler); return f; }
/** * abstract information from record header and then copy primitive bytes data of record to a primitive record. * @return * @throws IOException */ public ShpRecord parseRecordPrimitiveContent() throws IOException{ // get length of record content int contentLength = reader.readInt(); long recordLength = 2 * (contentLength + 4); remainLength -= recordLength; int typeID = EndianUtils.swapInteger(reader.readInt()); byte[] contentArray = new byte[contentLength * 2 - INT_LENGTH];// exclude the 4 bytes we read for shape type reader.read(contentArray,0,contentArray.length); return new ShpRecord(contentArray, typeID); }
/** * abstract information from record header and then copy primitive bytes data of record to a primitive record. * @return * @throws IOException */ public ShpRecord parseRecordPrimitiveContent(int length) throws IOException{ // get length of record content int contentLength = reader.readInt(); long recordLength = 2 * (contentLength + 4); remainLength -= recordLength; int typeID = EndianUtils.swapInteger(reader.readInt()); byte[] contentArray = new byte[length];// exclude the 4 bytes we read for shape type reader.read(contentArray,0,contentArray.length); return new ShpRecord(contentArray, typeID); }
private VorbisCommentHeader readCommentHeader(InputStream input) throws IOException, VorbisCommentReaderException { try { long vendorLength = EndianUtils.readSwappedUnsignedInteger(input); String vendorName = readUTF8String(input, vendorLength); long userCommentLength = EndianUtils .readSwappedUnsignedInteger(input); return new VorbisCommentHeader(vendorName, userCommentLength); } catch (UnsupportedEncodingException e) { throw new VorbisCommentReaderException(e); } }
public static THFrame readByIndex(int frameIndex, FileInputStream frameStream, FileInputStream listStream, FileInputStream elementStream, File tabFile, File chunksFile, THPalette palette) throws IOException { frameStream.getChannel().position(frameIndex * 10); int listIndex = EndianUtils.readSwappedInteger(frameStream) * 2; int width = frameStream.read(); int height = frameStream.read(); if(width == 0 || height == 0) return null; frameStream.skip(1); int flags = frameStream.read(); int nextFrame = EndianUtils.readSwappedShort(frameStream); THFrame res = new THFrame(frameIndex, width, height, flags, nextFrame, chunksFile, tabFile, palette); Vector<Integer> elementList = new Vector<Integer>(); listStream.getChannel().position(listIndex); while(true) { int elementIndex = EndianUtils.readSwappedShort(listStream); if(elementIndex == -1) break; SpriteElement element = SpriteElementReader.readByIndex(elementStream, elementIndex); res.addElement(element); } return res; }
public static Vector<Vector<String>> read(ABuffer raw) throws IOException { InputStream is = raw.createInputStream(); int sections = EndianUtils.readSwappedShort(is); Vector<Integer> counts = new Vector<Integer>(); for(int i = 0; i < sections; ++i) { counts.add((int)EndianUtils.readSwappedShort(is)); } Vector<Vector<String>> res = new Vector<Vector<String>>(); Reader r = new InputStreamReader(is, "Cp437"); for(int i= 0; i < sections; ++i) { int n = counts.elementAt(i); Vector<String> temp = new Vector<String>(); for(int j = 0; j < n; ++j) { temp.add(readNullTerminatedString(r)); } res.add(temp); } is.close(); return res; }
private static void readObjectInfo(FileInputStream saveStream, Tile tile, FileInputStream frameStream, FileInputStream listStream, FileInputStream elementStream, File tabFile, File chunksFile, THPalette palette) throws IOException { if(tile.getAnim() != 0) { int base = 131085 + tile.getAnim() * 175; ObjectInfo oi = new ObjectInfo(base); saveStream.getChannel().position(8 + base); int frameIndex = EndianUtils.readSwappedShort(saveStream); saveStream.skip(6); int byte16 = saveStream.read(); saveStream.getChannel().position(base + 29); oi.setLayerId(saveStream.read(), 0); oi.setLayerId(saveStream.read(), 1); oi.setLayerId(saveStream.read(), 2); oi.setLayerId(saveStream.read(), 3); oi.setLayerId(saveStream.read(), 4); oi.setLayerId(saveStream.read(), 5); oi.setLayerId(saveStream.read(), 6); oi.setLayerId(saveStream.read(), 7); oi.setLayerId(saveStream.read(), 8); oi.setLayerId(saveStream.read(), 9); oi.setLayerId(saveStream.read(), 10); oi.setLayerId(saveStream.read(), 11); oi.setLayerId(saveStream.read(), 12); THFrame frame = FramesReader.readByIndex(frameIndex, frameStream, listStream, elementStream, tabFile, chunksFile, palette); oi.setFrame(frame); oi.setByte16(byte16); tile.setObjectInfo(oi); } }
public static SpriteElement readByIndex(FileInputStream is, int index) throws IOException { is.getChannel().position(index * 6); int tabPos = EndianUtils.readSwappedShort(is); int offsetx = is.read(); int offsety = is.read(); int layerClass = is.read(); byte flags = (byte) (0xf & layerClass); layerClass = (layerClass & 0xf0) >>> 4; int id = is.read(); return new SpriteElement(index * 6, tabPos, offsetx, offsety, flags, id, layerClass); }
public Header1( DataInput di ) throws IOException { byte[] ba = new byte[4]; di.readFully( ba ); // cbHeader... long sizeof = EndianUtils.readSwappedUnsignedInteger( ba, 0 ); // logger.debug( "VH1 sizeof " + sizeof ); ba = new byte[(int)sizeof-4]; di.readFully( ba ); // u32Type... type = EndianUtils.readSwappedUnsignedInteger( ba, 0 ); //logger.debug( "type " + type ); // flags 4, comment 256, then... blocksOffset = EndianUtils.readSwappedUnsignedInteger( ba, 264 ); //logger.debug( "blocks offset " + blocksOffset ); dataOffset = EndianUtils.readSwappedUnsignedInteger( ba, 268 ); //logger.debug( "data offset " + dataOffset ); // disk geometry 16, dummy 4, then... diskSize = EndianUtils.readSwappedLong( ba, 292 ); blockSize = EndianUtils.readSwappedUnsignedInteger( ba, 300 ); long blockExtraSize = EndianUtils.readSwappedUnsignedInteger ( ba, 304 ); if( blockExtraSize != 0 ) { throw new VDIException ( "Non zero blockExtraSize not supported!" ); } blockCount = EndianUtils.readSwappedUnsignedInteger( ba, 308 ); // blocksAllocated 4, then... // RTUUID uuidCreate; // RTUUID uuidModify // RTUUID uuidLinkage; /* byte[] uuid = new byte[RTUUID.SIZEOF]; System.arraycopy( ba, 316, uuid, 0, uuid.length ); uuidCreate = new RTUUID( uuid ); System.arraycopy( ba, 316+2*RTUUID.SIZEOF, uuid, 0, uuid.length ); uuidLinkage = new RTUUID( uuid ); */ uuidCreate = readFrom( ba, 316 ); uuidLinkage = readFrom( ba, 316+32 ); }
/** * @param ba expected 512 bytes extracted from a .vmdk file. * * Normally at file start, but streamOptimized disks have * footers (matching header layout) near end of file too. */ public SparseExtentHeader( byte[] ba ) throws IOException { log = LogFactory.getLog( getClass() ); // uint32... long magic = EndianUtils.readSwappedUnsignedInteger( ba, 0 ); if( magic != MAGICNUMBER ) { throw new IllegalStateException ( "Unexpected magic number " + magic + ". No SparseExtentHeader..." ); } // uint32... version = EndianUtils.readSwappedUnsignedInteger( ba, 4 ); boolean allowVersion2Plus = true; if( version != 1 && !allowVersion2Plus ) { throw new IllegalStateException ( "Unexpected version " + version ); } // uint32... flags = (int)EndianUtils.readSwappedUnsignedInteger( ba, 8 ); /* The spec types the following fields as 'uint64' (via a typedef to SectorType), which we map to Java long. The fact that our long is signed is OK since this top bit could only be set in the vmdk if a size was 2^63 which is rather large ;) The units of all these 'SectorType' values is 512-byte sectors. */ capacity = EndianUtils.readSwappedLong( ba, 12 ); grainSize = EndianUtils.readSwappedLong( ba, 20 ); descriptorOffset = EndianUtils.readSwappedLong( ba, 28 ); descriptorSize = EndianUtils.readSwappedLong( ba, 36 ); // uint32... numGTEsPerGT = EndianUtils.readSwappedUnsignedInteger( ba, 44); log.debug( "GTEsPerGT " + numGTEsPerGT ); // SectorType... rgdOffset = EndianUtils.readSwappedLong( ba, 48 ); gdOffset = EndianUtils.readSwappedLong( ba, 56 ); overhead = EndianUtils.readSwappedLong( ba, 64 ); // uint8... int uncleanShutdown = ba[72] & 0xff; int singleEndLineChar = ba[73] & 0xff; int nonEndLineChar = ba[74] & 0xff; int doubleEndLineChar1 = ba[75] & 0xff; int doubleEndLineChar2 = ba[76] & 0xff; // uint16... compressAlgorithm = EndianUtils.readSwappedUnsignedShort( ba,77 ); /* gives a read count of 79 bytes, which leaves 512-79 = 433 bytes of padding. This agrees with the spec, which notes: uint8 pad[433]; */ }
public long readUnsignedInt() throws IOException { return EndianUtils.readSwappedUnsignedInteger(this); }
public short readShort() throws IOException { return EndianUtils.readSwappedShort(this); }
public int readUnsignedShort() throws IOException { return EndianUtils.readSwappedUnsignedShort(this); }
public void writeUnsignedShort(int num) throws IOException { EndianUtils.writeSwappedShort(stream, (short) num); }
public void writeUnsignedInt(int num) throws IOException { EndianUtils.writeSwappedInteger(stream, num); }
public void writeShort(int v) throws IOException { EndianUtils.writeSwappedShort(stream, (short) v); }
public void writeInt(int v) throws IOException { EndianUtils.writeSwappedInteger(stream, v); }