当前位置: 首页>>代码示例>>Java>>正文


Java RandomAccessMode类代码示例

本文整理汇总了Java中org.apache.commons.vfs2.util.RandomAccessMode的典型用法代码示例。如果您正苦于以下问题:Java RandomAccessMode类的具体用法?Java RandomAccessMode怎么用?Java RandomAccessMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RandomAccessMode类属于org.apache.commons.vfs2.util包,在下文中一共展示了RandomAccessMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRandomAccessContent

import org.apache.commons.vfs2.util.RandomAccessMode; //导入依赖的package包/类
/**
 * Returns an input/output stream to use to read and write the content of the file in an
 * random manner.
 * @param mode The RandomAccessMode.
 * @return A RandomAccessContent object to access the file.
 * @throws FileSystemException if an error occurs.
 */
public RandomAccessContent getRandomAccessContent(final RandomAccessMode mode) throws FileSystemException
{
    /*
    if (getThreadData().getState() != STATE_NONE)
    {
        throw new FileSystemException("vfs.provider/read-in-use.error", file);
    }
    */

    // Get the content
    final RandomAccessContent rastr = fileObject.getRandomAccessContent(mode);

    FileRandomAccessContent rac = new FileRandomAccessContent(fileObject, rastr);
    this.getThreadData().addRastr(rac);
    streamOpened();

    // setState(STATE_OPENED);
    return rac;
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:27,代码来源:DefaultFileContent.java

示例2: reloadFileObject

import org.apache.commons.vfs2.util.RandomAccessMode; //导入依赖的package包/类
public static void reloadFileObject(LoadingInfo loadingInfo, long position) throws IOException {
  loadingInfo.getFileObject().refresh();
  long currentSize = loadingInfo.getFileObject().getContent().getSize();
  IOUtils.closeQuietly(loadingInfo.getObserableInputStreamImpl());
  RandomAccessContent randomAccessContent = loadingInfo.getFileObject().getContent().getRandomAccessContent(RandomAccessMode.READ);
  randomAccessContent.seek(position);
  loadingInfo.setLastFileSize(currentSize);
  ObservableInputStreamImpl observableStream = new ObservableInputStreamImpl(randomAccessContent.getInputStream(),0);
  loadingInfo.setObserableInputStreamImpl(observableStream);
  if (loadingInfo.isGziped()) {
    loadingInfo.setContentInputStream(new GZIPInputStream(observableStream));
  } else {
    loadingInfo.setContentInputStream(observableStream);
  }
}
 
开发者ID:otros-systems,项目名称:otroslogviewer,代码行数:16,代码来源:Utils.java

示例3: FtpRandomAccessContent

import org.apache.commons.vfs2.util.RandomAccessMode; //导入依赖的package包/类
FtpRandomAccessContent(final FtpFileObject fileObject, RandomAccessMode mode)
{
    super(mode);

    this.fileObject = fileObject;
    // fileSystem = (FtpFileSystem) this.fileObject.getFileSystem();
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:8,代码来源:FtpRandomAccessContent.java

示例4: SftpRandomAccessContent

import org.apache.commons.vfs2.util.RandomAccessMode; //导入依赖的package包/类
SftpRandomAccessContent(final SftpFileObject fileObject, RandomAccessMode mode)
{
    super(mode);

    this.fileObject = fileObject;
    // fileSystem = (FtpFileSystem) this.fileObject.getFileSystem();
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:8,代码来源:SftpRandomAccessContent.java

示例5: HttpRandomAccessContent

import org.apache.commons.vfs2.util.RandomAccessMode; //导入依赖的package包/类
HttpRandomAccessContent(final HttpFileObject fileObject, RandomAccessMode mode)
{
    super(mode);

    this.fileObject = fileObject;
    fileSystem = (HttpFileSystem) this.fileObject.getFileSystem();
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:8,代码来源:HttpRandomAccessContent.java

示例6: doGetRandomAccessContent

import org.apache.commons.vfs2.util.RandomAccessMode; //导入依赖的package包/类
/**
 * random access
 */
@Override
protected RandomAccessContent doGetRandomAccessContent(final RandomAccessMode mode) throws Exception
{
    return new NfsFileRandomAccessContent(file, mode);
}
 
开发者ID:danniss,项目名称:common-vfs2-nfs,代码行数:9,代码来源:NfsFileObject.java

示例7: getRandomAccessContent

import org.apache.commons.vfs2.util.RandomAccessMode; //导入依赖的package包/类
public RandomAccessContent getRandomAccessContent( final RandomAccessMode arg0 ) throws FileSystemException {
  // not needed for our usage
  return null;
}
 
开发者ID:pentaho,项目名称:pentaho-osgi-bundles,代码行数:5,代码来源:MetadataToMondrianVfsFileContent.java

示例8: doGetRandomAccessContent

import org.apache.commons.vfs2.util.RandomAccessMode; //导入依赖的package包/类
@Override
protected RandomAccessContent doGetRandomAccessContent(final RandomAccessMode mode) throws Exception
{
    return new HttpRandomAccessContent(this, mode);
}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:6,代码来源:HttpFileObject.java

示例9: doGetRandomAccessContent

import org.apache.commons.vfs2.util.RandomAccessMode; //导入依赖的package包/类
/**
 * random access
 */
@Override
protected RandomAccessContent doGetRandomAccessContent(final RandomAccessMode mode) throws Exception
{
    return new SmbFileRandomAccessContent(file, mode);
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:9,代码来源:SmbFileObject.java

示例10: doGetRandomAccessContent

import org.apache.commons.vfs2.util.RandomAccessMode; //导入依赖的package包/类
@Override
protected RandomAccessContent doGetRandomAccessContent(final RandomAccessMode mode) throws Exception
{
    return new LocalFileRandomAccessContent(file, mode);
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:6,代码来源:LocalFile.java

示例11: LocalFileRandomAccessContent

import org.apache.commons.vfs2.util.RandomAccessMode; //导入依赖的package包/类
LocalFileRandomAccessContent(final File localFile, final RandomAccessMode mode) throws FileSystemException
{
    super(mode);

    try
    {
        raf = new RandomAccessFile(localFile, mode.getModeString());
        rafis = new InputStream()
        {
            @Override
            public int read() throws IOException
            {
                try
                {
                    return raf.readByte();
                }
                catch (EOFException e)
                {
                    return -1;
                }
            }

            @Override
            public long skip(long n) throws IOException
            {
                raf.seek(raf.getFilePointer() + n);
                return n;
            }

            @Override
            public void close() throws IOException
            {
                raf.close();
            }

            @Override
            public int read(byte[] b) throws IOException
            {
                return raf.read(b);
            }

            @Override
            public int read(byte[] b, int off, int len) throws IOException
            {
                return raf.read(b, off, len);
            }

            @Override
            public int available() throws IOException
            {
                long available = raf.length() - raf.getFilePointer();
                if (available > Integer.MAX_VALUE)
                {
                    return Integer.MAX_VALUE;
                }

                return (int) available;
            }
        };
    }
    catch (FileNotFoundException e)
    {
        throw new FileSystemException("vfs.provider/random-access-open-failed.error", localFile);
    }
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:66,代码来源:LocalFileRandomAccessContent.java

示例12: doGetRandomAccessContent

import org.apache.commons.vfs2.util.RandomAccessMode; //导入依赖的package包/类
@Override
protected RandomAccessContent doGetRandomAccessContent(RandomAccessMode mode)
        throws Exception
{
    return new RamFileRandomAccessContent(this, mode);
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:7,代码来源:RamFileObject.java

示例13: RamFileRandomAccessContent

import org.apache.commons.vfs2.util.RandomAccessMode; //导入依赖的package包/类
/**
 * @param file The file to access.
 * @param mode The access mode.
 */
public RamFileRandomAccessContent(RamFileObject file, RandomAccessMode mode)
{
    super();
    this.buf = file.getData().getBuffer();
    this.file = file;
    this.mode = mode;

    rafis = new InputStream()
    {
        @Override
        public int read() throws IOException
        {
            try
            {
                return readByte();
            }
            catch (EOFException e)
            {
                return -1;
            }
        }

        @Override
        public long skip(long n) throws IOException
        {
            seek(getFilePointer() + n);
            return n;
        }

        @Override
        public void close() throws IOException
        {
        }

        @Override
        public int read(byte[] b) throws IOException
        {
            return read(b, 0, b.length);
        }

        @Override
        public int read(byte[] b, int off, int len) throws IOException
        {
            int retLen = Math.min(len, getLeftBytes());
            RamFileRandomAccessContent.this.readFully(b, off, retLen);
            return retLen;
        }

        @Override
        public int available() throws IOException
        {
            return getLeftBytes();
        }
    };
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:60,代码来源:RamFileRandomAccessContent.java

示例14: doGetRandomAccessContent

import org.apache.commons.vfs2.util.RandomAccessMode; //导入依赖的package包/类
@Override
protected RandomAccessContent doGetRandomAccessContent(final RandomAccessMode mode) throws Exception
{
    return new FtpRandomAccessContent(this, mode);
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:6,代码来源:FtpFileObject.java

示例15: doGetRandomAccessContent

import org.apache.commons.vfs2.util.RandomAccessMode; //导入依赖的package包/类
@Override
protected RandomAccessContent doGetRandomAccessContent(
        final RandomAccessMode mode) throws Exception
{
    return new SftpRandomAccessContent(this, mode);
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:7,代码来源:SftpFileObject.java


注:本文中的org.apache.commons.vfs2.util.RandomAccessMode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。