本文整理汇总了Java中org.jaudiotagger.audio.generic.Utils.readUint32方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.readUint32方法的具体用法?Java Utils.readUint32怎么用?Java Utils.readUint32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jaudiotagger.audio.generic.Utils
的用法示例。
在下文中一共展示了Utils.readUint32方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEncodingInfo
import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
@Override
protected GenericAudioHeader getEncodingInfo(RandomAccessFile raf) throws CannotReadException, IOException
{
final GenericAudioHeader rv = new GenericAudioHeader();
final RealChunk prop = findPropChunk(raf);
final DataInputStream dis = prop.getDataInputStream();
final int objVersion = Utils.readUint16(dis);
if (objVersion == 0)
{
final long maxBitRate = Utils.readUint32(dis) / 1000;
final long avgBitRate = Utils.readUint32(dis) / 1000;
final long maxPacketSize = Utils.readUint32(dis);
final long avgPacketSize = Utils.readUint32(dis);
final long packetCnt = Utils.readUint32(dis);
final int duration = (int)Utils.readUint32(dis) / 1000;
final long preroll = Utils.readUint32(dis);
final long indexOffset = Utils.readUint32(dis);
final long dataOffset = Utils.readUint32(dis);
final int numStreams = Utils.readUint16(dis);
final int flags = Utils.readUint16(dis);
rv.setBitRate((int) avgBitRate);
rv.setPreciseLength(duration);
rv.setVariableBitRate(maxBitRate != avgBitRate);
}
return rv;
}
示例2: readChunk
import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
public static RealChunk readChunk(RandomAccessFile raf)
throws CannotReadException, IOException {
final String id = Utils.readString(raf, 4);
final int size = (int)Utils.readUint32(raf);
if (size < 8) {
throw new CannotReadException(
"Corrupt file: RealAudio chunk length at position "
+ (raf.getFilePointer() - 4)
+ " cannot be less than 8");
}
if (size > (raf.length() - raf.getFilePointer() + 8)) {
throw new CannotReadException(
"Corrupt file: RealAudio chunk length of " + size
+ " at position " + (raf.getFilePointer() - 4)
+ " extends beyond the end of the file");
}
final byte[] bytes = new byte[size - 8];
raf.readFully(bytes);
return new RealChunk(id, size, bytes);
}
示例3: readChunk
import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
/**
* Reads a chunk and extracts information.
*
* @return <code>false</code> if the chunk is structurally
* invalid, otherwise <code>true</code>
*/
public boolean readChunk() throws IOException {
int numComments = Utils.readUint16(raf);
// Create a List of comments
for (int i = 0; i < numComments; i++) {
long timestamp = Utils.readUint32(raf);
Date jTimestamp = AiffUtil.timestampToDate(timestamp);
int marker = Utils.readInt16(raf);
int count = Utils.readUint16(raf);
bytesLeft -= 8;
byte[] buf = new byte[count];
raf.read(buf);
bytesLeft -= count;
String cmt = new String(buf);
// Append a timestamp to the comment
cmt += " " + AiffUtil.formatDate(jTimestamp);
aiffHeader.addComment(cmt);
}
return true;
}
示例4: getEncodingInfo
import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
@Override
protected GenericAudioHeader getEncodingInfo(RandomAccessFile raf) throws CannotReadException, IOException {
final GenericAudioHeader rv = new GenericAudioHeader();
final RealChunk prop = findPropChunk(raf);
final DataInputStream dis = prop.getDataInputStream();
final int objVersion = Utils.readUint16(dis);
if (objVersion == 0) {
final long maxBitRate = Utils.readUint32(dis) / 1000;
final long avgBitRate = Utils.readUint32(dis) / 1000;
final long maxPacketSize = Utils.readUint32(dis);
final long avgPacketSize = Utils.readUint32(dis);
final long packetCnt = Utils.readUint32(dis);
final int duration = Utils.readUint32AsInt(dis) / 1000;
final long preroll = Utils.readUint32(dis);
final long indexOffset = Utils.readUint32(dis);
final long dataOffset = Utils.readUint32(dis);
final int numStreams = Utils.readUint16(dis);
final int flags = Utils.readUint16(dis);
rv.setBitrate((int) avgBitRate);
rv.setLength(duration);
rv.setVariableBitRate(maxBitRate != avgBitRate);
}
return rv;
}
示例5: readChunk
import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
/**
* Reads a chunk and extracts information.
*
* @return <code>false</code> if the chunk is structurally
* invalid, otherwise <code>true</code>
*/
public boolean readChunk() throws IOException {
long rawTimestamp = Utils.readUint32(raf);
// The timestamp is in seconds since January 1, 1904.
// We must convert to Java time.
Date timestamp = AiffUtil.timestampToDate(rawTimestamp);
aiffHeader.setTimestamp(timestamp);
return true;
}
示例6: readChunk
import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
@Override
public boolean readChunk() throws IOException {
int numChannels = Utils.readUint16(raf);
long numSampleFrames = Utils.readUint32(raf);
int sampleSize = Utils.readUint16(raf);
bytesLeft -= 8;
String compressionType = null;
String compressionName = null;
double sampleRate = AiffUtil.read80BitDouble(raf);
bytesLeft -= 10;
if (aiffHeader.getFileType() == AiffAudioHeader.FileType.AIFCTYPE) {
if (bytesLeft == 0) {
// This is a rather special case, but testing did turn up
// a file that misbehaved in this way.
return false;
}
compressionType = AiffUtil.read4Chars(raf);
// According to David Ackerman, the compression type can
// change the endianness of the document.
if (compressionType.equals("sowt")) {
aiffHeader.setEndian(AiffAudioHeader.Endian.LITTLE_ENDIAN);
}
bytesLeft -= 4;
compressionName = AiffUtil.readPascalString(raf);
bytesLeft -= compressionName.length() + 1;
}
aiffHeader.setBitsPerSample(sampleSize);
aiffHeader.setSamplingRate((int) sampleRate);
aiffHeader.setChannelNumber(numChannels);
aiffHeader.setLength((int) (numSampleFrames / sampleRate));
aiffHeader.setPreciseLength((float) (numSampleFrames / sampleRate));
aiffHeader.setLossless(true); // for all known compression types
// Proper handling of compression type should depend
// on whether raw output is set
if (compressionType != null) {
if (compressionType.equals("NONE")) {
} else if (compressionType.equals("raw ")) {
compressionName = "PCM 8-bit offset-binary";
} else if (compressionType.equals("twos")) {
compressionName = "PCM 16-bit twos-complement big-endian";
} else if (compressionType.equals("sowt")) {
compressionName = "PCM 16-bit twos-complement little-endian";
} else if (compressionType.equals("fl32")) {
compressionName = "PCM 32-bit integer";
} else if (compressionType.equals("fl64")) {
compressionName = "PCM 64-bit floating point";
} else if (compressionType.equals("in24")) {
compressionName = "PCM 24-bit integer";
} else if (compressionType.equals("in32")) {
compressionName = "PCM 32-bit integer";
} else {
aiffHeader.setLossless(false); // We don't know, so we have to assume lossy
}
aiffHeader.setAudioEncoding(compressionName);
// The size of the data after compression isn't available
// from the Common chunk, so we mark it as "unknown."
// With a bit more sophistication, we could combine the
// information from here and the Sound Data chunk to get
// the effective byte rate, but we're about to release.
String name = compressionName;
if (name == null || name.length() == 0) {
name = compressionType;
}
}
return true;
}