Codota Logo
PortableFileSystem
Code IndexAdd Codota to your IDE (free)

How to use
PortableFileSystem
in
org.kframework.krun.ioserver.filesystem.portable

Best Java code snippets using org.kframework.krun.ioserver.filesystem.portable.PortableFileSystem (Showing top 18 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: kframework/k

  static void processIOException(IOException e) throws IOException {
    if (e instanceof EOFException) {
      throw new IOException("EOF");
    }
    processErrno(e.getMessage(), e);
  }
}
origin: kframework/k

public long tell() throws IOException {
  try {
    return raf.getFilePointer();
  } catch (IOException e) {
    PortableFileSystem.processIOException(e);
    throw e; //unreachable
  }
}
origin: kframework/k

@Test
public void testReadFile() throws Exception {
  when(files.resolveWorkingDirectory(Matchers.anyString())).thenAnswer(new Answer<java.io.File>() {
    @Override
    public java.io.File answer(InvocationOnMock invocation)
        throws Throwable {
      return new java.io.File((String)invocation.getArguments()[0]);
    }
  });
  PortableFileSystem fs = new PortableFileSystem(kem, files);
  long fd = fs.open(new java.io.File(getClass().getResource("/fs-test.txt").toURI()).getAbsolutePath(), "r");
  File f = fs.get(fd);
  byte[] file = "foo\n".getBytes(Charset.forName("ASCII"));
  Assert.assertArrayEquals(file, f.read(4));
  try {
    f.read(1);
    Assert.fail();
  } catch (IOException e) {
    Assert.assertEquals("EOF", e.getMessage());
  }
}
origin: kframework/k

public void close(long fd) throws IOException {
  File f = get(fd);
  assert f instanceof org.kframework.krun.ioserver.filesystem.portable.File;
  ((org.kframework.krun.ioserver.filesystem.portable.File)f).close();
  files.remove(descriptors.get(fd));
  descriptors.remove(fd);
}
origin: kframework/k

} catch (FileNotFoundException e) {
  try {
    processFileNotFoundException(e);
  } catch (IOException ioe) {
    if (ioe.getMessage().equals("EISDIR") && mode.equals("r")) {
origin: kframework/k

public void write(byte[] b) throws IOException {
  try {
    raf.write(b);
  } catch (IOException e) {
    PortableFileSystem.processIOException(e);
  }
}
origin: kframework/k

static void processFileNotFoundException(FileNotFoundException e) throws IOException {
  String message = e.getMessage();
  int startIdx = message.lastIndexOf("(") + 1;
  int endIdx = message.length() - 1;
  String realMessage = message.substring(startIdx, endIdx);
  processErrno(realMessage, e);
}
origin: kframework/k

  void close() throws IOException {
    try {
      os.close();
    } catch (IOException e) {
      PortableFileSystem.processIOException(e);
    }
  }
}
origin: kframework/k

  void close() throws IOException {
    try {
      raf.close();
    } catch (IOException e) {
      PortableFileSystem.processIOException(e);
    }
  }
}
origin: kframework/k

  void close() throws IOException {
    try {
      is.close();
    } catch (IOException e) {
      PortableFileSystem.processIOException(e);
    }
  }
}
origin: kframework/k

public void seek(long pos) throws IOException {
  try {
    raf.seek(pos);
  } catch (IOException e) {
    PortableFileSystem.processIOException(e);
  }
}
origin: kframework/k

public void putc(byte b) throws IOException {
  try {
    os.write(b);
  } catch (IOException e) {
    PortableFileSystem.processIOException(e);
  } finally {
    os.flush();
  }
}
origin: kframework/k

public byte getc() throws IOException {
  int read;
  try {
    read = is.read();
  } catch (IOException e) {
    PortableFileSystem.processIOException(e);
    throw e; //unreachable
  }
  if (read == -1) {
    throw new IOException("EOF");
  }
  return (byte)read;
}
origin: kframework/k

public void write(byte[] b) throws IOException {
  try {
    os.write(b);
  } catch (IOException e) {
    PortableFileSystem.processIOException(e);
  } finally {
    os.flush();
  }
}
origin: kframework/k

public byte[] read(int n) throws IOException {
  int read;
  byte[] bytes;
  try {
    bytes = new byte[n];
    read = is.read(bytes);
  } catch (IOException e) {
    PortableFileSystem.processIOException(e);
    throw e; //unreachable
  }
  if (read == -1) {
    throw new IOException("EOF");
  }
  return Arrays.copyOfRange(bytes, 0, read);
}
origin: kframework/k

public byte[] read(int n) throws IOException {
  int read;
  byte[] bytes;
  try {
    bytes = new byte[n];
    read = raf.read(bytes);
  } catch (IOException e) {
    PortableFileSystem.processIOException(e);
    throw e; //unreachable
  }
  if (read == -1) {
    throw new IOException("EOF");
  }
  return Arrays.copyOfRange(bytes, 0, read);
}
origin: kframework/k

public byte getc() throws IOException {
  try {
    return raf.readByte();
  } catch (IOException e) {
    PortableFileSystem.processIOException(e);
    throw e; //unreachable
  }
}
origin: kframework/k

public void putc(byte b) throws IOException {
  try {
    raf.writeByte(b);
  } catch (IOException e) {
    PortableFileSystem.processIOException(e);
  }
}
org.kframework.krun.ioserver.filesystem.portablePortableFileSystem

Most used methods

  • get
  • <init>
  • open
  • processErrno
  • processFileNotFoundException
  • processIOException

Popular in Java

  • Reading from database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • getSystemService (Context)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • LinkedHashMap (java.util)
    Hash table and linked list implementation of the Map interface, with predictable iteration order. Th
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Notification (javax.management)
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now