# Class JSVFileManager

java.lang.Object
jspecview.common.JSVFileManager

public class JSVFileManager extends Object

## Field Summary

Fields
Modifier and Type
Field
Description
`static URL`
`appletDocumentBase`
`static String`
`jsDocumentBase`
`static final String`
`SIMULATION_PROTOCOL`
`static final int`
`URL_LOCAL`

## Constructor Summary

Constructors
Constructor
Description
`JSVFileManager()`

## Method Summary

Modifier and Type
Method
Description
`static String`
`cacheGet(String key)`
`static void`
`cachePut(String name, String data)`
`static String`
`fixUTF(byte[] bytes)`
`static String`
`getAbbrSimulationFileName(String name)`
In the case of applet-based simulations with file names that involve mol=..., we want to abbreviate those names for display
`static BufferedReader`
`getBufferedReaderForInputStream(InputStream in)`
`static BufferedReader`
`getBufferedReaderForStringOrBytes(Object stringOrBytes)`
`static BufferedReader`
`getBufferedReaderFromName(String name)`
`static String`
`getFileAsString(String name)`
`static String`
`getFullPathName(String name)`
FileManager.classifyName follow this with .replace('\\','/') and Escape.escape() to match Jmol's file name in
`static InputStream`
`getInputStream(String name, boolean showMsg, byte[] postBytes)`
`static String`
`getJmolFilePath(String filePath)`
`static String`
`getResourceString(Object object, String name, String[] error)`
`static String`
`getSimulationFileData(String name, String type)`
`static String`
`getSimulationType(String filePath)`
`static Object`
`getStreamAsBytes(BufferedInputStream bis, OC out)`
`static String`
`getTagName(String fileName)`
Returns a name that can be used as a tag, possibly abbreviated.
`static boolean`
`isAB(Object x)`
`boolean`
`isApplet()`
`static boolean`
`isLocal(String fileName)`
`static boolean`
`isURL(String name)`
`static boolean`
`isZipFile(InputStream is)`
`static String`
`postByteArray(String fileName, byte[] bytes)`
`static void`
`setDocumentBase(JSViewer v, URL documentBase)`
`static int`
`urlTypeIndex(String name)`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### SIMULATION_PROTOCOL

public static final String SIMULATION_PROTOCOL

See Also:
  - Constant Field Values

### appletDocumentBase

public static URL appletDocumentBase

### jsDocumentBase

public static String jsDocumentBase

### URL_LOCAL

public static final int URL_LOCAL

See Also:
  - Constant Field Values

## Constructor Details

### JSVFileManager

public JSVFileManager()

## Method Details

### isApplet

public boolean isApplet()

### getFileAsString

public static String getFileAsString(String name)

Parameters:
  `name` -
Returns:
  file as string

### getBufferedReaderForInputStream

public static BufferedReader getBufferedReaderForInputStream(InputStream in)

### getBufferedReaderForStringOrBytes

public static BufferedReader getBufferedReaderForStringOrBytes(Object stringOrBytes)

### getBufferedReaderFromName

public static BufferedReader getBufferedReaderFromName(String name) throws Exception

Throws:
  `Exception`

### getFullPathName

public static String getFullPathName(String name) throws JSVException
FileManager.classifyName follow this with .replace('\\','/') and Escape.escape() to match Jmol's file name in

Parameters:
  `name` -
Returns:
  name
Throws:
  `JSVException`

### isURL

public static boolean isURL(String name)

### urlTypeIndex

public static int urlTypeIndex(String name)

### isLocal

public static boolean isLocal(String fileName)

### getAbbrSimulationFileName

public static String getAbbrSimulationFileName(String name)
In the case of applet-based simulations with file names that involve mol=..., we want to abbreviate those names for display

Parameters:
  `name` - actual path name to simulation
Returns:
  actual name or hashed name

### getSimulationFileData

public static String getSimulationFileData(String name, String type)

### cachePut

public static void cachePut(String name, String data)

### cacheGet

public static String cacheGet(String key)

### isAB

public static boolean isAB(Object x)

### isZipFile

public static boolean isZipFile(InputStream is) throws JSVException

Throws:
  `JSVException`

### getStreamAsBytes

public static Object getStreamAsBytes(BufferedInputStream bis, OC out) throws JSVException

Throws:
  `JSVException`

### postByteArray

public static String postByteArray(String fileName, byte[] bytes)

### fixUTF

public static String fixUTF(byte[] bytes)

### getInputStream

public static InputStream getInputStream(String name, boolean showMsg, byte[] postBytes) throws JSVException

Throws:
  `JSVException`

### getResourceString

public static String getResourceString(Object object, String name, String[] error)

### getJmolFilePath

public static String getJmolFilePath(String filePath)

### getTagName

public static String getTagName(String fileName)
Returns a name that can be used as a tag, possibly abbreviated.

Parameters:
  `fileName` -
Returns:
  actual or abbreviated file name

### setDocumentBase

public static void setDocumentBase(JSViewer v, URL documentBase)

### getSimulationType

public static String getSimulationType(String filePath)