Tabnine Logo
FileContents
Code IndexAdd Tabnine to your IDE (free)

How to use
FileContents
in
javax.jnlp

Best Java code snippets using javax.jnlp.FileContents (Showing top 12 results out of 315)

origin: org.jdesktop.bsaf/bsaf

@Override
public InputStream openInputFile(String fileName) throws IOException {
  checkBasics("openInputFile");
  URL fileURL = fileNameToURL(fileName);
  try {
    return new BufferedInputStream(ps.get(fileURL).getInputStream());
  } catch (Exception e) {
    throw new IOException("openInputFile \"" + fileName + "\" failed", e);
  }
}
origin: org.jbundle.util/org.jbundle.util.muffinmanager

/**
 * Get the current value for this muffin.
 * @param strParam The key for this muffin parameter.
 * @return The value for this muffin (null if none).
 */
public String getMuffin(String strParam)
{
  try   {
    URL url = new URL(m_strCodeBase + strParam);
    FileContents fc = m_ps.get(url);
    if (fc == null)
      return null;
    // read in the contents of a muffin
    byte[] buf = new byte[(int)fc.getLength()];
    InputStream is = fc.getInputStream();
    int pos = 0;
    while((pos = is.read(buf, pos, buf.length - pos)) > 0) {
      // just loop
    }
    is.close();
    String strValue = new String(buf, ENCODING);
    return strValue;
  } catch (Exception ex)  {
    // Return null for any exception
  }
  return null;
}
/**
origin: net.sf.jga/jga

/**
 */
private String getClue(FileContents fc, URL source) {
  if (fc != null) 
    try { return fc.getName(); }
    catch (IOException x) {} // just fall through: failure _is_ an option in this case
  if (source != null)
    return source.getPath();
  return "worksheet.hwks";
}
origin: org.jdesktop.bsaf/bsaf

@Override
public OutputStream openOutputFile(String fileName, boolean append) throws IOException {
  checkBasics("openOutputFile");
  URL fileURL = fileNameToURL(fileName);
  try {
    FileContents fc = null;
    try {
      fc = ps.get(fileURL);
    } catch (FileNotFoundException e) {
      /* Verify that the max size for new PersistenceService
       * files is >= 100K (2^17) before opening one.
       */
      long maxSizeRequest = 131072L;
      long maxSize = ps.create(fileURL, maxSizeRequest);
      if (maxSize >= maxSizeRequest) {
        fc = ps.get(fileURL);
      }
    }
    if ((fc != null) && (fc.canWrite())) {
      return new BufferedOutputStream(fc.getOutputStream(!append));
    } else {
      throw new IOException("unable to create FileContents object");
    }
  } catch (Exception e) {
    throw new IOException("openOutputFile \"" + fileName + "\" failed", e);
  }
}
origin: net.sf.jga/jga

/**
 * Loads the file via the JNLP FileOpen service
 */
public int loadFile(Spreadsheet sheet) {
  final Controller controller = getController();
  try { 
    FileOpenService fos = (FileOpenService)
      ServiceManager.lookup("javax.jnlp.FileOpenService"); 
    if (fos == null) {
      return Controller.CANCEL_OPTION;
    }
       // ask user to select a file through this service 
    _fc = fos.openFileDialog(null, null);
    if (_fc == null)
      return Controller.CANCEL_OPTION;
    
    sheet.readSpreadsheet(_fc.getInputStream());
    controller.setSheetSource(new URL("file:///"+_fc.getName()));
    controller.setSheetDirty(false);
    return Controller.YES_OPTION;
  }
  catch (Exception x) {
    displayError(x);
    return Controller.CANCEL_OPTION;
  }
}
origin: org.jbundle.util/org.jbundle.util.muffinmanager

  fc.getMaxLength(); // This will throw an exception if there is no muffin yet.
} catch (Exception ex)  {
  fc = null;
    OutputStream os = fc.getOutputStream(false);
    byte[] buf = strValue.getBytes(ENCODING);
    os.write(buf);
origin: org.slick2d/slick2d-core

.getOutputStream(false));
origin: net.java.dev.appframework/appframework

public OutputStream openOutputFile(String fileName) throws IOException {
  checkBasics("openOutputFile");
  URL fileURL = fileNameToURL(fileName);
  try {
  FileContents fc = null;
  try {
    fc = ps.get(fileURL);  
  }
  catch (FileNotFoundException e) {
    /* Verify that the max size for new PersistenceService 
     * files is >= 100K (2^17) before opening one.
     */
    long maxSizeRequest = 131072L;
    long maxSize = ps.create(fileURL, maxSizeRequest);
    if (maxSize >= maxSizeRequest) {
    fc = ps.get(fileURL);
    }
  }
  if ((fc != null) && (fc.canWrite())) {
    return new BufferedOutputStream(fc.getOutputStream(true));
  }
  else {
    throw new IOException("unable to create FileContents object");
  }
  } 
  catch(Exception e) {
  throw new LSException("openOutputFile \"" + fileName + "\" failed", e);
  }
}
origin: org.jbundle.util/org.jbundle.util.muffinmanager

/**
 * Open this file.
 * @return
 */
public InputStream openFileStream(String pathHint, String[] extensions)
{
  if (fos == null)
  {
    try { 
      fos = (FileOpenService)ServiceManager.lookup("javax.jnlp.FileOpenService"); 
    } catch (UnavailableServiceException e) { 
      fos = null; 
    }
  }
  if (fos != null) { 
    try { 
      // ask user to select a file through this service 
      FileContents fc = fos.openFileDialog(pathHint, extensions);
      return fc.getInputStream();
    } catch (Exception e) { 
      e.printStackTrace(); 
    } 
  } 
  return null;
}
origin: net.sf.jga/jga

controller.setSheetSource(new URL("file:///"+_fc.getName()));
controller.setSheetDirty(false);
pipeIn.close();
origin: net.java.dev.appframework/appframework

public InputStream openInputFile(String fileName) throws IOException {
  checkBasics("openInputFile");
  URL fileURL = fileNameToURL(fileName);
  try {
  return new BufferedInputStream(ps.get(fileURL).getInputStream());
  } 
  catch(Exception e) {
  throw new LSException("openInputFile \"" + fileName + "\" failed", e);
  }
}
origin: org.slick2d/slick2d-core

URL configURL = new URL(baseURL, fileName);
FileContents fc = ps.get(configURL);
DataInputStream ois = new DataInputStream(fc.getInputStream());
javax.jnlpFileContents

Most used methods

  • getInputStream
  • getOutputStream
  • canWrite
  • getLength
  • getMaxLength
  • getName

Popular in Java

  • Making http requests using okhttp
  • onCreateOptionsMenu (Activity)
  • getApplicationContext (Context)
  • compareTo (BigDecimal)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now