本文整理汇总了Java中com.ochafik.lang.jnaerator.runtime.NativeSizeByReference.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java NativeSizeByReference.setValue方法的具体用法?Java NativeSizeByReference.setValue怎么用?Java NativeSizeByReference.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ochafik.lang.jnaerator.runtime.NativeSizeByReference
的用法示例。
在下文中一共展示了NativeSizeByReference.setValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doRead
import com.ochafik.lang.jnaerator.runtime.NativeSizeByReference; //导入方法依赖的package包/类
private synchronized byte doRead(Pointer bufPtr, NativeSize num, NativeSizeByReference read) {
try {
initStreamIfNecessary();
if ( m_eof ) {
read.setValue(new NativeSize(0));
return 1;
}
int size = num.intValue();
ByteBuffer buf = bufPtr.getByteBuffer(0, size);
int numRead = m_chan.read(buf);
if ( numRead<=0 ) {
// reached EOF
m_eof=true;
numRead=0;
}
read.setValue(new NativeSize(numRead));
return 1;
} catch ( Exception e ) {
s_log.error("Error accessing " + m_src.getDescription(), e);
return 0;
}
}
示例2: doSkip
import com.ochafik.lang.jnaerator.runtime.NativeSizeByReference; //导入方法依赖的package包/类
private synchronized byte doSkip(NativeSize num, NativeSizeByReference skipped) {
try {
initStreamIfNecessary();
if ( m_eof ) {
skipped.setValue(new NativeSize(0));
return 1;
}
long size = num.longValue();
long numSkipped = m_stream.skip(size);
// InputStream just keeps skipping at EOF
// Need to check if there are any bytes, or it could skip forever
int next = m_stream.read();
if ( next==-1 ) {
m_eof = true;
} else {
m_stream.unread(next);
}
skipped.setValue(new NativeSize(numSkipped));
return 1;
} catch ( Exception e ) {
s_log.error("Error accessing " + m_src.getDescription(), e);
return 0;
}
}
示例3: doRead
import com.ochafik.lang.jnaerator.runtime.NativeSizeByReference; //导入方法依赖的package包/类
private synchronized byte doRead(Pointer bufPtr, NativeSize num, NativeSizeByReference read) {
try {
initRandomAccessIfNecessary();
int size = num.intValue();
ByteBuffer buf = bufPtr.getByteBuffer(0, size);
int numRead = m_chan.read(buf);
read.setValue(new NativeSize(numRead));
return 1;
} catch ( Exception e ) {
handleError("reading", e);
return 0;
}
}
示例4: doGetLocation
import com.ochafik.lang.jnaerator.runtime.NativeSizeByReference; //导入方法依赖的package包/类
private synchronized byte doGetLocation(NativeSizeByReference loc) {
try {
initRandomAccessIfNecessary();
long location = m_chan.position();
loc.setValue(new NativeSize(location));
return 1;
} catch ( Exception e ) {
handleError("getting location", e);
return 0;
}
}
示例5: doGetSize
import com.ochafik.lang.jnaerator.runtime.NativeSizeByReference; //导入方法依赖的package包/类
private synchronized byte doGetSize(NativeSizeByReference size) {
try {
initRandomAccessIfNecessary();
size.setValue(new NativeSize(m_chan.size()));
return 1;
} catch ( Exception e ) {
handleError("getting size", e);
return 0;
}
}
示例6: doGetSize
import com.ochafik.lang.jnaerator.runtime.NativeSizeByReference; //导入方法依赖的package包/类
private synchronized byte doGetSize(NativeSizeByReference size) {
try {
initSizeIfNecessary();
size.setValue(new NativeSize(m_size));
return 1;
} catch ( Exception e ) {
s_log.error("Error accessing " + m_src.getDescription(), e);
return 0;
}
}